Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
60327b5
feat: byteArray for byte arrays
tabaktoni Aug 4, 2025
06e3c11
chore: unstaged files
tabaktoni Aug 4, 2025
e898ea4
feat: initial impl. ByteArray using composable Cairo types, Cairobyte…
tabaktoni Aug 6, 2025
cce9d16
Merge branch 'develop' into fix/1455
tabaktoni Aug 6, 2025
10dd269
feat: polish tests and implementation, Api factory added
tabaktoni Aug 7, 2025
031b043
fix: bytearray integration tests without parser, fix padding and compile
tabaktoni Aug 7, 2025
9f8b5a8
chore: integration test
tabaktoni Aug 7, 2025
9bc92dd
feat: extend parser to configurable response parsing, integrate Cairo…
tabaktoni Aug 8, 2025
3884f13
fix: compiled api request calldata should be hex not decimal string
tabaktoni Aug 12, 2025
dfae30f
feat: parserHR, contract integration, contract prop req/res parsing, …
tabaktoni Aug 12, 2025
770c304
feat: contract optional waitForTransaction on ivoke
tabaktoni Aug 12, 2025
509e072
feat: contract invoke waitForTransaction, fix: tx receipt helper fixe…
tabaktoni Aug 12, 2025
13e39b8
feat: new data driven parsing strategy,def hdParsingStrategy and fast…
tabaktoni Aug 12, 2025
11389fe
feat: init parsing strategies, test: event byteArray, fix: decodeUtf8
tabaktoni Aug 12, 2025
c2ca0b3
feat: integrate rest of the simplest CairoTypes in parsing strategy
tabaktoni Aug 12, 2025
2f58ae6
feat: reduce TX wait time, and provide known failed reasons based on …
tabaktoni Aug 13, 2025
b09edc6
test: eventless write bytearray xtest
tabaktoni Aug 13, 2025
1dbd9fc
feat: uint static factory methods
tabaktoni Aug 13, 2025
0b27d0d
refactor: cleanup
tabaktoni Aug 13, 2025
228bc6b
feat: missing primitive integers implemented as cairo types
tabaktoni Aug 13, 2025
2dd92e9
chore: cleanup
tabaktoni Aug 13, 2025
e901466
feat: CairoType integers (#1472)
tabaktoni Aug 13, 2025
cffa8c6
fix: signed int hex format, compiled helper
tabaktoni Aug 14, 2025
131a54f
chore: resolve merge
tabaktoni Aug 14, 2025
37e951b
feat: a Buffer in browser and Buffer config
tabaktoni Aug 14, 2025
2c4d15d
chore: typeof clenup
tabaktoni Aug 14, 2025
74a8069
Update src/utils/cairoDataTypes/felt.ts
tabaktoni Aug 14, 2025
b20a690
test: message fix
tabaktoni Aug 14, 2025
7ed200c
chore: init CairoType interface
tabaktoni Aug 14, 2025
a9572d5
feat: initial fixedarray refactor to cairo class
tabaktoni Aug 14, 2025
a7b57ab
feat: completed CairoFixedArray implementation
tabaktoni Aug 15, 2025
0478110
feat: a CairoArray lfg
tabaktoni Aug 15, 2025
8d62cac
feat: cxairo tuples
tabaktoni Aug 15, 2025
91ec780
feat: init Cairo Secp256k1PointStruct
tabaktoni Aug 18, 2025
cd1b4e4
Merge branch 'develop' into cairotypes/all
tabaktoni Sep 24, 2025
92d8035
chore: post merge cleanup
tabaktoni Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/cairo1v2_typed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
RawArgsArray,
RawArgsObject,
TypedContractV2,
byteArray,
CairoByteArray,
cairo,
ec,
hash,
Expand Down Expand Up @@ -991,7 +991,7 @@ describe('Cairo 1', () => {
expect(callD).toEqual(expectedResult);
const callD2 = CallData.compile({ mess: message });
expect(callD2).toEqual(expectedResult);
const callD3 = CallData.compile({ mess: byteArray.byteArrayFromString('Take care.') });
const callD3 = CallData.compile({ mess: new CairoByteArray('Take care.') });
expect(callD3).toEqual(['0', '398475857363345939260718', '10']);
const str1 = await stringContract.get_string();
expect(str1).toBe(
Expand Down
15 changes: 9 additions & 6 deletions __tests__/cairoByteArrayContract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { contracts } from './config/fixtures';
import { createTestProvider, getTestAccount } from './config/fixturesInit';
import { toHex } from '../src/utils/num';
import { CairoType } from '../src/utils/cairoDataTypes/cairoType.interface';

describe('CairoByteArray Manual Integration Tests', () => {
let provider: ProviderInterface;
Expand Down Expand Up @@ -479,11 +480,12 @@ describe('CairoByteArray Contract Integration Tests', () => {
test('should store and read Buffer file, custom response parsing strategy', async () => {
// Create custom parsing strategy that extends hdParsingStrategy
const customParsingStrategy: ParsingStrategy = {
request: hdParsingStrategy.request,
dynamicSelectors: hdParsingStrategy.dynamicSelectors,
constructors: hdParsingStrategy.constructors,
response: {
...hdParsingStrategy.response,
[CairoByteArray.abiSelector]: (responseIterator: Iterator<string>) => {
return CairoByteArray.factoryFromApiResponse(responseIterator).toBuffer();
[CairoByteArray.abiSelector]: (instance: CairoType) => {
return (instance as CairoByteArray).toBuffer();
},
},
};
Expand Down Expand Up @@ -514,11 +516,12 @@ describe('CairoByteArray Contract Integration Tests', () => {
xtest('should store and read large Buffer file without event, custom response parsing strategy', async () => {
// Create custom parsing strategy that extends hdParsingStrategy
const customParsingStrategy: ParsingStrategy = {
request: hdParsingStrategy.request,
dynamicSelectors: hdParsingStrategy.dynamicSelectors,
constructors: hdParsingStrategy.constructors,
response: {
...hdParsingStrategy.response,
[CairoByteArray.abiSelector]: (responseIterator: Iterator<string>) => {
return CairoByteArray.factoryFromApiResponse(responseIterator).toBuffer();
[CairoByteArray.abiSelector]: (instance: CairoType) => {
return (instance as CairoByteArray).toBuffer();
},
},
};
Expand Down
23 changes: 16 additions & 7 deletions __tests__/cairov24onward.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import {
CallData,
Contract,
ProviderInterface,
byteArray,
CairoByteArray,
cairo,
hdParsingStrategy,
num,
type Uint512,
} from '../src';
Expand Down Expand Up @@ -86,7 +87,7 @@ describe('Cairo v2.4 onwards', () => {
expect(callD).toEqual(expectedResult);
const callD2 = CallData.compile({ mess: message });
expect(callD2).toEqual(expectedResult);
const callD3 = CallData.compile({ mess: byteArray.byteArrayFromString('Take care.') });
const callD3 = CallData.compile({ mess: new CairoByteArray('Take care.') });
expect(callD3).toEqual(['0', '398475857363345939260718', '10']);
const str1 = await stringContract.get_string();
expect(str1).toBe(
Expand Down Expand Up @@ -438,7 +439,7 @@ describe('Cairo v2.4 onwards', () => {
describe('Cairo v2.9.2 fixed-array', () => {
const myArray: number[] = [1, 2, 3, 4, 5, 6, 7, 8];
const myWrongArray = [...myArray, 9];
const expectedCalldata = myArray.map((val) => val.toString());
const expectedCalldata = myArray.map((val) => `0x${val.toString(16)}`);
let fixedArrayContract: Contract;

beforeAll(async () => {
Expand Down Expand Up @@ -470,14 +471,22 @@ describe('Cairo v2.4 onwards', () => {
expect(res0).toEqual(expectedRes);
const res1 = await fixedArrayContract.fixed_array(myArray);
expect(res1).toEqual(expectedRes);
const myCalldata = CallData.compile([CairoFixedArray.compile(myArray)]);
const myCalldata = CallData.compile([
Object.fromEntries(myArray.map((item, idx) => [idx.toString(), item])),
]);
const res2 = await fixedArrayContract.call('fixed_array', myCalldata);
expect(res2).toEqual(expectedRes);
const myCalldata3 = myCallData.compile('fixed_array', [CairoFixedArray.compile(myArray)]);
const myCalldata3 = myCallData.compile('fixed_array', [
Object.fromEntries(myArray.map((item, idx) => [idx.toString(), item])),
]);
const res3 = await fixedArrayContract.call('fixed_array', myCalldata3);
expect(res3).toEqual(expectedRes);
const myFixedArray = new CairoFixedArray(myArray, '[core::integer::u32; 8]');
const myCalldata4 = myCallData.compile('fixed_array', { x: myFixedArray.compile() });
const myFixedArray = new CairoFixedArray(
myArray,
'[core::integer::u32; 8]',
hdParsingStrategy
);
const myCalldata4 = myCallData.compile('fixed_array', { x: myFixedArray });
const res4 = await fixedArrayContract.call('fixed_array', myCalldata4);
expect(res4).toEqual(expectedRes);
});
Expand Down
6 changes: 3 additions & 3 deletions __tests__/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
CallData,
uint256,
num,
byteArray,
CairoByteArray,
RpcError,
ReceiptTx,
} from '../src';
Expand Down Expand Up @@ -455,8 +455,8 @@ describe('Complex interaction', () => {
classHash,
account,
constructorCalldata: CallData.compile({
name: byteArray.byteArrayFromString('Token'),
symbol: byteArray.byteArrayFromString('ERC20'),
name: new CairoByteArray('Token'),
symbol: new CairoByteArray('ERC20'),
amount: cairo.uint256('1000000000'),
recipient: account.address,
owner: '0x823d5a0c0eefdc9a6a1cb0e064079a6284f3b26566b677a32c71bbe7bf9f8c',
Expand Down
Loading
Loading