Skip to content

Commit 35e3715

Browse files
committed
feat: ledger Signer 225
docs: update guide build: ledger app v2.3.0 chore: upgrade name to 2.3.1 and polish doc docs: update guide chore: upgrade name to 2.3.1 and polish doc feat: prune deprecated functionalities BREAKING CHANGE: Removed multiple functionalities that have been marked as deprecated chore(release): 7.0.0-beta.4 [skip ci] * repair snip-12 enum type nested dependency ([starknet-io#1289](starknet-io#1289)) ([1cd4219](starknet-io@1cd4219)) * drop fetch-cookie dependency ([9a57daf](starknet-io@9a57daf)) * drop isomorphic-fetch dependency ([9da0083](starknet-io@9da0083)) * prune deprecated functionalities ([cbd18f5](starknet-io@cbd18f5)) * Removed multiple functionalities that have been marked as deprecated chore(release): 7.0.0 [skip ci] * Implement RPC 0.8 and V3 transactions ([starknet-io#1328](starknet-io#1328)) ([316ae27](starknet-io@316ae27)) * contract withOptions Fix/1252 ([starknet-io#1255](starknet-io#1255)) ([b59952e](starknet-io@b59952e)) * update ws impl, add TEST_WS_URL, update token constants ([411eeec](starknet-io@411eeec)) * drop fetch-cookie dependency ([9a57daf](starknet-io@9a57daf)) * drop isomorphic-fetch dependency ([9da0083](starknet-io@9da0083)) * prune deprecated functionalities ([cbd18f5](starknet-io@cbd18f5)) * the WebSockets ([starknet-io#1251](starknet-io#1251)) ([fabca27](starknet-io@fabca27)), closes [starknet-io#1272](starknet-io#1272) * Update Beta to latest Develop ([starknet-io#1312](starknet-io#1312)) ([2958051](starknet-io@2958051)), closes [starknet-io#949](starknet-io#949) [starknet-io#970](starknet-io#970) * v7 fee, new methods, tests ([starknet-io#1337](starknet-io#1337)) ([00743de](starknet-io@00743de)) * Removed multiple functionalities that have been marked as deprecated * Library defaults to RPC 0.8 with the corresponding API changes, dropped RPC 0.6 support fix: preserve value for numeric arguments within address padding utility chore(release): 7.0.1 [skip ci] * preserve value for numeric arguments within address padding utility ([abc7958](starknet-io@abc7958)) docs: generate documentation version docs: expand v7 migration guide (starknet-io#1368) --------- Co-authored-by: Petar Penovic <pp@spaceshard.io> fix: make the provider create method generic to enable it when mixins are applied (starknet-io#1370) fix: ensure enum replacement objects are reachable for type resolution (starknet-io#1375) docs: update guides for v7 (starknet-io#1376) --------- Co-authored-by: Petar Penovic <pp@spaceshard.io> feat: update to rpc 0.8.1 chore(release): 7.1.0 [skip ci] * ensure enum replacement objects are reachable for type resolution ([starknet-io#1375](starknet-io#1375)) ([eb8b10d](starknet-io@eb8b10d)) * make the provider create method generic to enable it when mixins are applied ([starknet-io#1370](starknet-io#1370)) ([1f48dc6](starknet-io@1f48dc6)) * update to rpc 0.8.1 ([83e17b8](starknet-io@83e17b8)) style: remove comment
1 parent c60be42 commit 35e3715

File tree

282 files changed

+49289
-862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+49289
-862
lines changed

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
# [7.1.0](https://github.com/starknet-io/starknet.js/compare/v7.0.1...v7.1.0) (2025-04-14)
2+
3+
### Bug Fixes
4+
5+
- ensure enum replacement objects are reachable for type resolution ([#1375](https://github.com/starknet-io/starknet.js/issues/1375)) ([eb8b10d](https://github.com/starknet-io/starknet.js/commit/eb8b10dd075475d83cbd4748b610d911f945823f))
6+
- make the provider create method generic to enable it when mixins are applied ([#1370](https://github.com/starknet-io/starknet.js/issues/1370)) ([1f48dc6](https://github.com/starknet-io/starknet.js/commit/1f48dc6957aea8d5480f5413c184ac82ea5dd0db))
7+
8+
### Features
9+
10+
- update to rpc 0.8.1 ([83e17b8](https://github.com/starknet-io/starknet.js/commit/83e17b8b385fe00b5d2ed476de80a6773565bd9a))
11+
12+
## [7.0.1](https://github.com/starknet-io/starknet.js/compare/v7.0.0...v7.0.1) (2025-03-28)
13+
14+
### Bug Fixes
15+
16+
- preserve value for numeric arguments within address padding utility ([abc7958](https://github.com/starknet-io/starknet.js/commit/abc7958a68f5edc396f038f2352a9d747980502f))
17+
18+
# [7.0.0](https://github.com/starknet-io/starknet.js/compare/v6.24.1...v7.0.0) (2025-03-28)
19+
20+
- Implement RPC 0.8 and V3 transactions ([#1328](https://github.com/starknet-io/starknet.js/issues/1328)) ([316ae27](https://github.com/starknet-io/starknet.js/commit/316ae2789376368dcffe653ce4817eebf0a63d97))
21+
22+
### Bug Fixes
23+
24+
- contract withOptions Fix/1252 ([#1255](https://github.com/starknet-io/starknet.js/issues/1255)) ([b59952e](https://github.com/starknet-io/starknet.js/commit/b59952e74baf82641d6028c96625db104049c02e))
25+
- update ws impl, add TEST_WS_URL, update token constants ([411eeec](https://github.com/starknet-io/starknet.js/commit/411eeec1df6a38358f28612260066b38fc942957))
26+
27+
### Features
28+
29+
- drop fetch-cookie dependency ([9a57daf](https://github.com/starknet-io/starknet.js/commit/9a57dafce473432df7040f68e0824e9e78f6e215))
30+
- drop isomorphic-fetch dependency ([9da0083](https://github.com/starknet-io/starknet.js/commit/9da0083d2084b0bd9ec7da06ea9a80f267f4e397))
31+
- prune deprecated functionalities ([cbd18f5](https://github.com/starknet-io/starknet.js/commit/cbd18f59fb0749c558ba4eabc0f094464941b088))
32+
- the WebSockets ([#1251](https://github.com/starknet-io/starknet.js/issues/1251)) ([fabca27](https://github.com/starknet-io/starknet.js/commit/fabca27a7a3e398030a99cf8d78bffa51cebfe9a)), closes [#1272](https://github.com/starknet-io/starknet.js/issues/1272)
33+
- Update Beta to latest Develop ([#1312](https://github.com/starknet-io/starknet.js/issues/1312)) ([2958051](https://github.com/starknet-io/starknet.js/commit/295805116cf0f57b8708f545cc187f19f79588f4)), closes [#949](https://github.com/starknet-io/starknet.js/issues/949) [#970](https://github.com/starknet-io/starknet.js/issues/970)
34+
- v7 fee, new methods, tests ([#1337](https://github.com/starknet-io/starknet.js/issues/1337)) ([00743de](https://github.com/starknet-io/starknet.js/commit/00743de2cad5375a558844646f11b4adef15188b))
35+
36+
### BREAKING CHANGES
37+
38+
- Removed multiple functionalities that have been marked as deprecated
39+
- Library defaults to RPC 0.8 with the corresponding API changes, dropped RPC 0.6 support
40+
41+
# [7.0.0-beta.4](https://github.com/starknet-io/starknet.js/compare/v7.0.0-beta.3...v7.0.0-beta.4) (2025-03-28)
42+
43+
### Bug Fixes
44+
45+
- repair snip-12 enum type nested dependency ([#1289](https://github.com/starknet-io/starknet.js/issues/1289)) ([1cd4219](https://github.com/starknet-io/starknet.js/commit/1cd4219df5e61a676bc58ba8c8673269695fc2db))
46+
47+
### Features
48+
49+
- drop fetch-cookie dependency ([9a57daf](https://github.com/starknet-io/starknet.js/commit/9a57dafce473432df7040f68e0824e9e78f6e215))
50+
- drop isomorphic-fetch dependency ([9da0083](https://github.com/starknet-io/starknet.js/commit/9da0083d2084b0bd9ec7da06ea9a80f267f4e397))
51+
- prune deprecated functionalities ([cbd18f5](https://github.com/starknet-io/starknet.js/commit/cbd18f59fb0749c558ba4eabc0f094464941b088))
52+
53+
### BREAKING CHANGES
54+
55+
- Removed multiple functionalities that have been marked as deprecated
56+
157
# [7.0.0-beta.3](https://github.com/starknet-io/starknet.js/compare/v7.0.0-beta.2...v7.0.0-beta.3) (2025-03-13)
258

359
### Features

__tests__/account.starknetId.test.ts

Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,39 +46,36 @@ describe('deploy and test Wallet', () => {
4646
});
4747
multicallAddress = multicallResponse.deploy.contract_address;
4848

49-
const { transaction_hash } = await account.execute(
50-
[
51-
{
52-
contractAddress: devnetERC20Address,
53-
entrypoint: 'approve',
54-
calldata: [namingAddress, 0, 1], // Price of domain
55-
},
56-
{
57-
contractAddress: identityAddress,
58-
entrypoint: 'mint',
59-
calldata: ['1'], // TokenId
60-
},
61-
{
62-
contractAddress: namingAddress,
63-
entrypoint: 'buy',
64-
calldata: [
65-
'1', // Starknet id linked
66-
'1499554868251', // Domain encoded "fricoben"
67-
'62', // days
68-
'0', // resolver
69-
0, // sponsor
70-
0,
71-
0,
72-
],
73-
},
74-
{
75-
contractAddress: identityAddress,
76-
entrypoint: 'set_main_id',
77-
calldata: ['1'],
78-
},
79-
],
80-
undefined
81-
);
49+
const { transaction_hash } = await account.execute([
50+
{
51+
contractAddress: devnetERC20Address,
52+
entrypoint: 'approve',
53+
calldata: [namingAddress, 0, 1], // Price of domain
54+
},
55+
{
56+
contractAddress: identityAddress,
57+
entrypoint: 'mint',
58+
calldata: ['1'], // TokenId
59+
},
60+
{
61+
contractAddress: namingAddress,
62+
entrypoint: 'buy',
63+
calldata: [
64+
'1', // Starknet id linked
65+
'1499554868251', // Domain encoded "fricoben"
66+
'62', // days
67+
'0', // resolver
68+
0, // sponsor
69+
0,
70+
0,
71+
],
72+
},
73+
{
74+
contractAddress: identityAddress,
75+
entrypoint: 'set_main_id',
76+
calldata: ['1'],
77+
},
78+
]);
8279

8380
await provider.waitForTransaction(transaction_hash);
8481
});
@@ -102,21 +99,18 @@ describe('deploy and test Wallet', () => {
10299
describe('Test getStarkProfile', () => {
103100
beforeAll(async () => {
104101
// Add verifier data
105-
const { transaction_hash: transaction_hash_verifier } = await account.execute(
106-
[
107-
{
108-
contractAddress: identityAddress,
109-
entrypoint: 'set_verifier_data',
110-
calldata: [
111-
'1', // token_id
112-
shortString.encodeShortString('discord'), // field
113-
123, // value
114-
0,
115-
],
116-
},
117-
],
118-
undefined
119-
);
102+
const { transaction_hash: transaction_hash_verifier } = await account.execute([
103+
{
104+
contractAddress: identityAddress,
105+
entrypoint: 'set_verifier_data',
106+
calldata: [
107+
'1', // token_id
108+
shortString.encodeShortString('discord'), // field
109+
123, // value
110+
0,
111+
],
112+
},
113+
]);
120114
await provider.waitForTransaction(transaction_hash_verifier);
121115
});
122116

__tests__/account.test.ts

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
DeclareDeployUDCResponse,
88
Provider,
99
ProviderInterface,
10-
RpcError,
1110
TransactionType,
1211
cairo,
1312
constants,
@@ -363,29 +362,6 @@ describe('deploy and test Wallet', () => {
363362
expect(balance.low).toStrictEqual(toBigInt(990));
364363
});
365364

366-
test('execute with and without deprecated abis parameter', async () => {
367-
const transaction = {
368-
contractAddress: erc20Address,
369-
entrypoint: 'transfer',
370-
calldata: [erc20.address, '10', '0'],
371-
};
372-
const details: Parameters<(typeof account)['execute']>[2] = { nonce: 0 };
373-
374-
let error1: RpcError | undefined;
375-
// eslint-disable-next-line no-return-assign
376-
await account.execute(transaction, details).catch((e) => (error1 = e));
377-
expect(error1).toBeDefined();
378-
expect(error1).toBeInstanceOf(RpcError);
379-
expect(error1!.isType('TRANSACTION_EXECUTION_ERROR')).toBe(true);
380-
381-
let error2: RpcError | undefined;
382-
// eslint-disable-next-line no-return-assign
383-
await account.execute(transaction, undefined, details).catch((e) => (error2 = e));
384-
expect(error2).toBeDefined();
385-
expect(error2).toBeInstanceOf(RpcError);
386-
expect(error2!.isType('TRANSACTION_EXECUTION_ERROR')).toBe(true);
387-
});
388-
389365
test('execute with custom nonce', async () => {
390366
const result = await account.getNonce();
391367
const nonce = toBigInt(result);
@@ -395,7 +371,6 @@ describe('deploy and test Wallet', () => {
395371
entrypoint: 'transfer',
396372
calldata: [account.address, '10', '0'],
397373
},
398-
undefined,
399374
{ nonce }
400375
);
401376

@@ -433,14 +408,14 @@ describe('deploy and test Wallet', () => {
433408
const r2 = toBigInt(r) + 123n;
434409

435410
const signature2 = new Signature(toBigInt(r2.toString()), toBigInt(s));
436-
437411
if (!signature2) return;
438412

439-
const verifMessageResponse: boolean = await account.verifyMessage(
413+
const verifyMessageResponse: boolean = await account.verifyMessageInStarknet(
440414
typedDataExample,
441-
signature2
415+
signature2,
416+
account.address
442417
);
443-
expect(verifMessageResponse).toBe(false);
418+
expect(verifyMessageResponse).toBe(false);
444419

445420
const wrongAccount = new Account(
446421
provider,
@@ -449,14 +424,17 @@ describe('deploy and test Wallet', () => {
449424
undefined,
450425
TEST_TX_VERSION
451426
); // non existing account
452-
await expect(wrongAccount.verifyMessage(typedDataExample, signature2)).rejects.toThrow();
427+
await expect(
428+
wrongAccount.verifyMessageInStarknet(typedDataExample, signature2, wrongAccount.address)
429+
).rejects.toThrow();
453430
});
454431

455432
test('sign and verify message', async () => {
456433
const signature = await account.signMessage(typedDataExample);
457-
const verifMessageResponse: boolean = await account.verifyMessage(
434+
const verifMessageResponse: boolean = await account.verifyMessageInStarknet(
458435
typedDataExample,
459-
signature
436+
signature,
437+
account.address
460438
);
461439
expect(verifMessageResponse).toBe(true);
462440
});

__tests__/cairov24onward.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ describe('Cairo v2.4 onwards', () => {
176176

177177
test('Tuple ((u256,(u16,Order2)), u8)', async () => {
178178
type Order2 = {
179-
p1: num.BigNumberish;
180-
p2: num.BigNumberish[];
179+
p1: BigNumberish;
180+
p2: BigNumberish[];
181181
};
182182
const myOrder2: Order2 = { p1: 100, p2: [5, 6, 7] };
183183
const calldata9 = myCallData.compile('get_tuple9', {

__tests__/rpcProvider.test.ts

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
import { getStarkKey, Signature, utils } from '@scure/starknet';
2+
import { hasMixin } from 'ts-mixer';
3+
import {
4+
contracts,
5+
createBlockForDevnet,
6+
createTestProvider,
7+
describeIfDevnet,
8+
describeIfNotDevnet,
9+
describeIfRpc,
10+
describeIfTestnet,
11+
ETHtokenAddress,
12+
getTestAccount,
13+
waitNextBlock,
14+
} from './config/fixtures';
15+
import { initializeMatcher } from './config/schema';
216
import typedDataExample from '../__mocks__/typedData/baseExample.json';
317
import {
418
Account,
519
Block,
620
CallData,
721
Contract,
822
FeeEstimate,
23+
LibraryError,
924
ProviderInterface,
1025
RPC,
1126
RPCResponseParser,
@@ -19,21 +34,11 @@ import {
1934
import { StarknetChainId } from '../src/global/constants';
2035
import { felt, uint256 } from '../src/utils/calldata/cairo';
2136
import { toBigInt, toHexString } from '../src/utils/num';
22-
import {
23-
contracts,
24-
createBlockForDevnet,
25-
createTestProvider,
26-
describeIfDevnet,
27-
describeIfNotDevnet,
28-
describeIfRpc,
29-
describeIfTestnet,
30-
ETHtokenAddress,
31-
getTestAccount,
32-
waitNextBlock,
33-
} from './config/fixtures';
34-
import { initializeMatcher } from './config/schema';
35-
import { isBoolean } from '../src/utils/typed';
3637
import { isVersion } from '../src/utils/provider';
38+
import { isBoolean } from '../src/utils/typed';
39+
import { RpcProvider as BaseRpcProvider } from '../src/provider/rpc';
40+
import { RpcProvider as ExtendedRpcProvider } from '../src/provider/extensions/default';
41+
import { StarknetId } from '../src/provider/extensions/starknetId';
3742

3843
describeIfRpc('RPCProvider', () => {
3944
let rpcProvider: RpcProvider;
@@ -53,6 +58,16 @@ describeIfRpc('RPCProvider', () => {
5358
await createBlockForDevnet();
5459
});
5560

61+
test('create should be usable by the base and extended RpcProvider, but not Account', async () => {
62+
const nodeUrl = process.env.TEST_RPC_URL;
63+
const base = await BaseRpcProvider.create({ nodeUrl });
64+
const extended = await ExtendedRpcProvider.create({ nodeUrl });
65+
66+
expect(hasMixin(base, StarknetId)).toBe(false);
67+
expect(hasMixin(extended, StarknetId)).toBe(true);
68+
await expect(Account.create()).rejects.toThrow(LibraryError);
69+
});
70+
5671
test('detect spec version with create', async () => {
5772
const providerTest = await RpcProvider.create({ nodeUrl: process.env.TEST_RPC_URL });
5873
const { channel } = providerTest;
@@ -326,11 +341,6 @@ describeIfRpc('RPCProvider', () => {
326341
expect(transaction).toHaveProperty('transaction_hash');
327342
});
328343

329-
test('getPendingTransactions', async () => {
330-
const transactions = await rpcProvider.getPendingTransactions();
331-
expect(Array.isArray(transactions)).toBe(true);
332-
});
333-
334344
test('getSyncingStats', async () => {
335345
const syncingStats = await rpcProvider.getSyncingStats();
336346
expect(syncingStats).toMatchSchemaRef('GetSyncingStatsResponse');

__tests__/transactionReceipt.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Transaction receipt utility - RPC 0.7 - V2', () => {
3333

3434
test('test for Success variant', async () => {
3535
const myCall: Call = contract.populate('test_fail', { p1: 100 });
36-
const res = await account.execute(myCall, undefined, { maxFee: 1 * 10 ** 15 }); // maxFee needed to not throw error in getEstimateFee
36+
const res = await account.execute(myCall, { maxFee: 1 * 10 ** 15 }); // maxFee needed to not throw error in getEstimateFee
3737
const txR = await provider.waitForTransaction(res.transaction_hash);
3838
expect(txR.value).toHaveProperty('execution_status', TransactionExecutionStatus.SUCCEEDED);
3939
expect(txR.statusReceipt).toBe('success');
@@ -54,7 +54,7 @@ describe('Transaction receipt utility - RPC 0.7 - V2', () => {
5454

5555
test('test for Reverted variant', async () => {
5656
const myCall: Call = contract.populate('test_fail', { p1: 10 }); // reverted if not 100
57-
const res = await account.execute(myCall, undefined, { maxFee: 1 * 10 ** 15 }); // maxFee needed to not throw error in getEstimateFee
57+
const res = await account.execute(myCall, { maxFee: 1 * 10 ** 15 }); // maxFee needed to not throw error in getEstimateFee
5858
const txR = await provider.waitForTransaction(res.transaction_hash);
5959
expect(txR.value).toHaveProperty('execution_status', TransactionExecutionStatus.REVERTED);
6060
expect(txR.statusReceipt).toBe('reverted');

__tests__/utils/address.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ describe('addAddressPadding', () => {
2020

2121
return expect(addAddressPadding(addr)).toBe(padded);
2222
});
23+
24+
test('should pad a number value', () => {
25+
const addr1 = 31;
26+
const addr2 = 0x1f;
27+
const padded = '0x000000000000000000000000000000000000000000000000000000000000001f';
28+
29+
expect(addAddressPadding(addr1)).toBe(padded);
30+
expect(addAddressPadding(addr2)).toBe(padded);
31+
});
32+
33+
test('should pad a bigint value', () => {
34+
const addr = constants.ADDR_BOUND;
35+
const padded = '0x07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00';
36+
37+
expect(addAddressPadding(addr)).toBe(padded);
38+
});
2339
});
2440

2541
describe('validateAndParseAddress', () => {

0 commit comments

Comments
 (0)