starknet 4.17.0 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +2 -10
- package/dist/index.d.ts +27 -9
- package/dist/index.global.js +30 -13
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +30 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
- package/.babelrc +0 -6
- package/.commitlintrc +0 -22
- package/.eslintignore +0 -2
- package/.eslintrc +0 -28
- package/.prettierrc +0 -6
- package/.releaserc +0 -28
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -52
- package/__mocks__/Account.json +0 -25486
- package/__mocks__/ERC20.json +0 -40027
- package/__mocks__/TestDapp.json +0 -12962
- package/__mocks__/contract.json +0 -33191
- package/__mocks__/l1l2_compiled.json +0 -10107
- package/__mocks__/multicall.json +0 -8139
- package/__mocks__/naming_compiled.json +0 -53283
- package/__mocks__/starknetId_compiled.json +0 -44703
- package/__mocks__/typedDataExample.json +0 -35
- package/__mocks__/typedDataSessionExample.json +0 -42
- package/__mocks__/typedDataStructArrayExample.json +0 -44
- package/__tests__/account.test.ts +0 -345
- package/__tests__/contract.test.ts +0 -249
- package/__tests__/defaultProvider.test.ts +0 -177
- package/__tests__/fixtures.ts +0 -84
- package/__tests__/jest.setup.ts +0 -30
- package/__tests__/rpcProvider.test.ts +0 -132
- package/__tests__/sequencerProvider.test.ts +0 -123
- package/__tests__/utils/__snapshots__/ellipticalCurve.test.ts.snap +0 -5
- package/__tests__/utils/__snapshots__/utils.browser.test.ts.snap +0 -5
- package/__tests__/utils/__snapshots__/utils.test.ts.snap +0 -5
- package/__tests__/utils/address.test.ts +0 -45
- package/__tests__/utils/ellipticalCurve.test.ts +0 -91
- package/__tests__/utils/merkle.test.ts +0 -256
- package/__tests__/utils/shortString.test.ts +0 -22
- package/__tests__/utils/starknetId.test.ts +0 -53
- package/__tests__/utils/transactionHash.test.ts +0 -17
- package/__tests__/utils/typedData.test.ts +0 -223
- package/__tests__/utils/uint256.test.ts +0 -32
- package/__tests__/utils/utils.browser.test.ts +0 -29
- package/__tests__/utils/utils.test.ts +0 -141
- package/img/logo.svg +0 -17
- package/index.d.ts +0 -2683
- package/index.global.js +0 -23192
- package/index.global.js.map +0 -1
- package/index.js +0 -4910
- package/index.js.map +0 -1
- package/index.mjs +0 -4852
- package/index.mjs.map +0 -1
- package/src/account/default.ts +0 -501
- package/src/account/index.ts +0 -2
- package/src/account/interface.ts +0 -309
- package/src/constants.ts +0 -2065
- package/src/contract/contractFactory.ts +0 -88
- package/src/contract/default.ts +0 -425
- package/src/contract/index.ts +0 -3
- package/src/contract/interface.ts +0 -106
- package/src/index.ts +0 -26
- package/src/provider/default.ts +0 -187
- package/src/provider/errors.ts +0 -14
- package/src/provider/index.ts +0 -9
- package/src/provider/interface.ts +0 -281
- package/src/provider/rpc.ts +0 -482
- package/src/provider/sequencer.ts +0 -523
- package/src/provider/utils.ts +0 -100
- package/src/signer/default.ts +0 -99
- package/src/signer/index.ts +0 -2
- package/src/signer/interface.ts +0 -77
- package/src/types/account.ts +0 -43
- package/src/types/api/index.ts +0 -10
- package/src/types/api/openrpc.ts +0 -607
- package/src/types/api/rpc.ts +0 -45
- package/src/types/api/sequencer.ts +0 -369
- package/src/types/contract.ts +0 -5
- package/src/types/index.ts +0 -8
- package/src/types/lib.ts +0 -143
- package/src/types/provider.ts +0 -134
- package/src/types/signer.ts +0 -24
- package/src/utils/address.ts +0 -44
- package/src/utils/calldata.ts +0 -250
- package/src/utils/ellipticCurve.ts +0 -120
- package/src/utils/encode.ts +0 -66
- package/src/utils/events.ts +0 -32
- package/src/utils/fetchPonyfill.ts +0 -5
- package/src/utils/hash.ts +0 -235
- package/src/utils/json.ts +0 -15
- package/src/utils/merkle.ts +0 -69
- package/src/utils/number.ts +0 -98
- package/src/utils/provider.ts +0 -28
- package/src/utils/responseParser/index.ts +0 -28
- package/src/utils/responseParser/rpc.ts +0 -70
- package/src/utils/responseParser/sequencer.ts +0 -135
- package/src/utils/shortString.ts +0 -21
- package/src/utils/stark.ts +0 -57
- package/src/utils/starknetId.ts +0 -116
- package/src/utils/transaction.ts +0 -56
- package/src/utils/typedData/index.ts +0 -247
- package/src/utils/typedData/types.ts +0 -37
- package/src/utils/typedData/utils.ts +0 -16
- package/src/utils/uint256.ts +0 -32
- package/src/utils/url.ts +0 -53
- package/tsconfig.eslint.json +0 -4
- package/tsup.config.ts +0 -9
- package/www/README.md +0 -41
- package/www/babel.config.js +0 -3
- package/www/code-examples/account.js +0 -65
- package/www/code-examples/amm.js +0 -44
- package/www/code-examples/erc20.js +0 -13
- package/www/code-examples/package-lock.json +0 -336
- package/www/code-examples/package.json +0 -15
- package/www/docs/API/_category_.json +0 -5
- package/www/docs/API/account.md +0 -463
- package/www/docs/API/changelog.md +0 -15
- package/www/docs/API/contract.md +0 -135
- package/www/docs/API/contractFactory.md +0 -45
- package/www/docs/API/index.md +0 -3
- package/www/docs/API/provider.md +0 -725
- package/www/docs/API/signer.md +0 -105
- package/www/docs/API/utils.md +0 -374
- package/www/docusaurus.config.js +0 -130
- package/www/guides/account.md +0 -140
- package/www/guides/cra.md +0 -3
- package/www/guides/erc20.md +0 -163
- package/www/guides/intro.md +0 -63
- package/www/package-lock.json +0 -20405
- package/www/package.json +0 -43
- package/www/sidebars.js +0 -31
- package/www/src/components/HomepageFeatures/index.tsx +0 -67
- package/www/src/components/HomepageFeatures/styles.module.css +0 -10
- package/www/src/css/custom.css +0 -39
- package/www/src/pages/index.module.css +0 -23
- package/www/src/pages/index.tsx +0 -40
- package/www/src/pages/markdown-page.md +0 -7
- package/www/static/.nojekyll +0 -0
- package/www/static/img/docusaurus.png +0 -0
- package/www/static/img/favicon.ico +0 -0
- package/www/static/img/logo.svg +0 -17
- package/www/static/img/starknet-1.png +0 -0
- package/www/static/img/starknet-2.png +0 -0
- package/www/static/img/starknet-3.png +0 -0
- package/www/static/img/tutorial/docsVersionDropdown.png +0 -0
- package/www/static/img/tutorial/localeDropdown.png +0 -0
package/dist/index.mjs
CHANGED
|
@@ -2840,14 +2840,16 @@ var RpcProvider = class {
|
|
|
2840
2840
|
}
|
|
2841
2841
|
async deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }, details) {
|
|
2842
2842
|
return this.fetchEndpoint("starknet_addDeployAccountTransaction", {
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2843
|
+
deploy_account_transaction: {
|
|
2844
|
+
constructor_calldata: bigNumberishArrayToHexadecimalStringArray(constructorCalldata || []),
|
|
2845
|
+
class_hash: toHex(toBN(classHash)),
|
|
2846
|
+
contract_address_salt: toHex(toBN(addressSalt || 0)),
|
|
2847
|
+
type: "DEPLOY_ACCOUNT",
|
|
2848
|
+
max_fee: toHex(toBN(details.maxFee || 0)),
|
|
2849
|
+
version: toHex(toBN(details.version || 0)),
|
|
2850
|
+
signature: bigNumberishArrayToHexadecimalStringArray(signature || []),
|
|
2851
|
+
nonce: toHex(toBN(details.nonce))
|
|
2852
|
+
}
|
|
2851
2853
|
});
|
|
2852
2854
|
}
|
|
2853
2855
|
async invokeFunction(functionInvocation, details) {
|
|
@@ -2857,7 +2859,7 @@ var RpcProvider = class {
|
|
|
2857
2859
|
calldata: parseCalldata(functionInvocation.calldata),
|
|
2858
2860
|
type: "INVOKE",
|
|
2859
2861
|
max_fee: toHex(toBN(details.maxFee || 0)),
|
|
2860
|
-
version: toHex(toBN(details.version ||
|
|
2862
|
+
version: toHex(toBN(details.version || 1)),
|
|
2861
2863
|
signature: bigNumberishArrayToHexadecimalStringArray(functionInvocation.signature || []),
|
|
2862
2864
|
nonce: toHex(toBN(details.nonce))
|
|
2863
2865
|
}
|
|
@@ -3131,7 +3133,8 @@ var SequencerProvider = class {
|
|
|
3131
3133
|
"add_transaction",
|
|
3132
3134
|
"call_contract",
|
|
3133
3135
|
"estimate_fee",
|
|
3134
|
-
"estimate_message_fee"
|
|
3136
|
+
"estimate_message_fee",
|
|
3137
|
+
"simulate_transaction"
|
|
3135
3138
|
];
|
|
3136
3139
|
return postMethodEndpoints.includes(endpoint) ? "POST" : "GET";
|
|
3137
3140
|
}
|
|
@@ -3376,6 +3379,20 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
3376
3379
|
};
|
|
3377
3380
|
return this.fetchEndpoint("estimate_message_fee", { blockIdentifier }, validCallL1Handler);
|
|
3378
3381
|
}
|
|
3382
|
+
async simulateTransaction(invocation, invocationDetails, blockIdentifier = this.blockIdentifier) {
|
|
3383
|
+
return this.fetchEndpoint(
|
|
3384
|
+
"simulate_transaction",
|
|
3385
|
+
{ blockIdentifier },
|
|
3386
|
+
{
|
|
3387
|
+
type: "INVOKE_FUNCTION",
|
|
3388
|
+
contract_address: invocation.contractAddress,
|
|
3389
|
+
calldata: invocation.calldata ?? [],
|
|
3390
|
+
signature: bigNumberishArrayToDecimalStringArray(invocation.signature || []),
|
|
3391
|
+
version: toHex(toBN((invocationDetails == null ? void 0 : invocationDetails.version) || 1)),
|
|
3392
|
+
nonce: toHex(toBN(invocationDetails.nonce))
|
|
3393
|
+
}
|
|
3394
|
+
);
|
|
3395
|
+
}
|
|
3379
3396
|
};
|
|
3380
3397
|
|
|
3381
3398
|
// src/provider/default.ts
|
|
@@ -4517,8 +4534,8 @@ var Account = class extends Provider {
|
|
|
4517
4534
|
addressSalt = 0,
|
|
4518
4535
|
constructorCalldata = [],
|
|
4519
4536
|
contractAddress: providedContractAddress
|
|
4520
|
-
}, { blockIdentifier
|
|
4521
|
-
const nonce =
|
|
4537
|
+
}, { blockIdentifier } = {}) {
|
|
4538
|
+
const nonce = "0x0";
|
|
4522
4539
|
const version = toBN(feeTransactionVersion);
|
|
4523
4540
|
const chainId = await this.getChainId();
|
|
4524
4541
|
const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, constructorCalldata, 0);
|
|
@@ -4677,7 +4694,7 @@ var Account = class extends Provider {
|
|
|
4677
4694
|
addressSalt = 0,
|
|
4678
4695
|
contractAddress: providedContractAddress
|
|
4679
4696
|
}, transactionsDetail = {}) {
|
|
4680
|
-
const nonce =
|
|
4697
|
+
const nonce = "0x0";
|
|
4681
4698
|
const version = toBN(transactionVersion);
|
|
4682
4699
|
const chainId = await this.getChainId();
|
|
4683
4700
|
const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, constructorCalldata, 0);
|