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.js
CHANGED
|
@@ -2897,14 +2897,16 @@ var RpcProvider = class {
|
|
|
2897
2897
|
}
|
|
2898
2898
|
async deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }, details) {
|
|
2899
2899
|
return this.fetchEndpoint("starknet_addDeployAccountTransaction", {
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2900
|
+
deploy_account_transaction: {
|
|
2901
|
+
constructor_calldata: bigNumberishArrayToHexadecimalStringArray(constructorCalldata || []),
|
|
2902
|
+
class_hash: toHex(toBN(classHash)),
|
|
2903
|
+
contract_address_salt: toHex(toBN(addressSalt || 0)),
|
|
2904
|
+
type: "DEPLOY_ACCOUNT",
|
|
2905
|
+
max_fee: toHex(toBN(details.maxFee || 0)),
|
|
2906
|
+
version: toHex(toBN(details.version || 0)),
|
|
2907
|
+
signature: bigNumberishArrayToHexadecimalStringArray(signature || []),
|
|
2908
|
+
nonce: toHex(toBN(details.nonce))
|
|
2909
|
+
}
|
|
2908
2910
|
});
|
|
2909
2911
|
}
|
|
2910
2912
|
async invokeFunction(functionInvocation, details) {
|
|
@@ -2914,7 +2916,7 @@ var RpcProvider = class {
|
|
|
2914
2916
|
calldata: parseCalldata(functionInvocation.calldata),
|
|
2915
2917
|
type: "INVOKE",
|
|
2916
2918
|
max_fee: toHex(toBN(details.maxFee || 0)),
|
|
2917
|
-
version: toHex(toBN(details.version ||
|
|
2919
|
+
version: toHex(toBN(details.version || 1)),
|
|
2918
2920
|
signature: bigNumberishArrayToHexadecimalStringArray(functionInvocation.signature || []),
|
|
2919
2921
|
nonce: toHex(toBN(details.nonce))
|
|
2920
2922
|
}
|
|
@@ -3188,7 +3190,8 @@ var SequencerProvider = class {
|
|
|
3188
3190
|
"add_transaction",
|
|
3189
3191
|
"call_contract",
|
|
3190
3192
|
"estimate_fee",
|
|
3191
|
-
"estimate_message_fee"
|
|
3193
|
+
"estimate_message_fee",
|
|
3194
|
+
"simulate_transaction"
|
|
3192
3195
|
];
|
|
3193
3196
|
return postMethodEndpoints.includes(endpoint) ? "POST" : "GET";
|
|
3194
3197
|
}
|
|
@@ -3433,6 +3436,20 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
3433
3436
|
};
|
|
3434
3437
|
return this.fetchEndpoint("estimate_message_fee", { blockIdentifier }, validCallL1Handler);
|
|
3435
3438
|
}
|
|
3439
|
+
async simulateTransaction(invocation, invocationDetails, blockIdentifier = this.blockIdentifier) {
|
|
3440
|
+
return this.fetchEndpoint(
|
|
3441
|
+
"simulate_transaction",
|
|
3442
|
+
{ blockIdentifier },
|
|
3443
|
+
{
|
|
3444
|
+
type: "INVOKE_FUNCTION",
|
|
3445
|
+
contract_address: invocation.contractAddress,
|
|
3446
|
+
calldata: invocation.calldata ?? [],
|
|
3447
|
+
signature: bigNumberishArrayToDecimalStringArray(invocation.signature || []),
|
|
3448
|
+
version: toHex(toBN((invocationDetails == null ? void 0 : invocationDetails.version) || 1)),
|
|
3449
|
+
nonce: toHex(toBN(invocationDetails.nonce))
|
|
3450
|
+
}
|
|
3451
|
+
);
|
|
3452
|
+
}
|
|
3436
3453
|
};
|
|
3437
3454
|
|
|
3438
3455
|
// src/provider/default.ts
|
|
@@ -4574,8 +4591,8 @@ var Account = class extends Provider {
|
|
|
4574
4591
|
addressSalt = 0,
|
|
4575
4592
|
constructorCalldata = [],
|
|
4576
4593
|
contractAddress: providedContractAddress
|
|
4577
|
-
}, { blockIdentifier
|
|
4578
|
-
const nonce =
|
|
4594
|
+
}, { blockIdentifier } = {}) {
|
|
4595
|
+
const nonce = "0x0";
|
|
4579
4596
|
const version = toBN(feeTransactionVersion);
|
|
4580
4597
|
const chainId = await this.getChainId();
|
|
4581
4598
|
const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, constructorCalldata, 0);
|
|
@@ -4734,7 +4751,7 @@ var Account = class extends Provider {
|
|
|
4734
4751
|
addressSalt = 0,
|
|
4735
4752
|
contractAddress: providedContractAddress
|
|
4736
4753
|
}, transactionsDetail = {}) {
|
|
4737
|
-
const nonce =
|
|
4754
|
+
const nonce = "0x0";
|
|
4738
4755
|
const version = toBN(transactionVersion);
|
|
4739
4756
|
const chainId = await this.getChainId();
|
|
4740
4757
|
const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, constructorCalldata, 0);
|