starknet 4.17.1 → 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 +12 -0
- package/README.md +2 -10
- package/dist/index.d.ts +18 -4
- package/dist/index.global.js +17 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -2
- 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 -2687
- package/index.global.js +0 -23194
- package/index.global.js.map +0 -1
- package/index.js +0 -4912
- package/index.js.map +0 -1
- package/index.mjs +0 -4854
- 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 -311
- 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 -484
- 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 -609
- 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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [4.18.0](https://github.com/0xs34n/starknet.js/compare/v4.17.1...v4.18.0) (2022-12-23)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- merge develop into branch ([21efcb1](https://github.com/0xs34n/starknet.js/commit/21efcb1cefd6ea70a9d49e060ff620e88002e3b6))
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- simulate_transaction support on sequencer ([304c3cc](https://github.com/0xs34n/starknet.js/commit/304c3cc1af81bc8810581546f043caca01db173b))
|
|
10
|
+
- update simulate tx ([8f3ea55](https://github.com/0xs34n/starknet.js/commit/8f3ea55eb1e23cefc0419902a2ebbe10ee373ccb))
|
|
11
|
+
- update simulate tx in sequencer ([d79a9fa](https://github.com/0xs34n/starknet.js/commit/d79a9faa307936561504c120f67f3fb2f18423b6))
|
|
12
|
+
|
|
1
13
|
## [4.17.1](https://github.com/0xs34n/starknet.js/compare/v4.17.0...v4.17.1) (2022-12-14)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -56,14 +56,6 @@ Guides can be found [here](https://www.starknetjs.com/guides/intro)
|
|
|
56
56
|
|
|
57
57
|
[Click Here](https://www.starknetjs.com/docs/API/)
|
|
58
58
|
|
|
59
|
-
## 🚀 Powered by Starknet.js
|
|
60
|
-
|
|
61
|
-
- [Argent X - the first StarkNet wallet](https://github.com/argentlabs/argent-x)
|
|
62
|
-
- [Braavos - your new wallet on top of StarkNet](https://chrome.google.com/webstore/detail/braavos-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma)
|
|
63
|
-
- [React + Starknet.js boilerplate](https://github.com/fracek/starknet-react-example)
|
|
64
|
-
- [AMM Demo](https://www.starknetswap.com/)
|
|
65
|
-
- [mySwap - the first DeFi app to launch on StarkNet](https://myswap.xyz)
|
|
66
|
-
|
|
67
59
|
## ✏️ Contributing
|
|
68
60
|
|
|
69
61
|
If you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/0xs34n/starknet.js/blob/main/CONTRIBUTING.md) first.
|
|
@@ -72,9 +64,9 @@ If you consider to contribute to this project please read [CONTRIBUTING.md](http
|
|
|
72
64
|
|
|
73
65
|
Special thanks to all the [contributors](https://github.com/0xs34n/starknet.js/graphs/contributors), especially to:
|
|
74
66
|
|
|
75
|
-
Janek ([@janek26](https://github.com/janek26))
|
|
67
|
+
Janek ([@janek26](https://github.com/janek26)) and Dhruv ([@dhruvkelawala](https://github.com/dhruvkelawala)) from [Argent](https://github.com/argentlabs)
|
|
76
68
|
|
|
77
|
-
|
|
69
|
+
Toni ([@tabaktoni](https://github.com/tabaktoni)) and Ivan ([@ivpavici](https://github.com/ivpavici)) from [Shard Labs](https://shardlabs.io/)
|
|
78
70
|
|
|
79
71
|
and of course the [StarkWare](https://starkware.co/) team for their dedicated support!
|
|
80
72
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1114,7 +1114,7 @@ declare type ExecutionResources = {
|
|
|
1114
1114
|
};
|
|
1115
1115
|
n_memory_holes: number;
|
|
1116
1116
|
};
|
|
1117
|
-
declare type
|
|
1117
|
+
declare type TransactionTraceResponse = {
|
|
1118
1118
|
validate_invocation?: FunctionInvocation;
|
|
1119
1119
|
function_invocation?: FunctionInvocation;
|
|
1120
1120
|
fee_transfer_invocation?: FunctionInvocation;
|
|
@@ -1256,10 +1256,16 @@ declare namespace Sequencer {
|
|
|
1256
1256
|
type DeployAccountEstimateFee = Omit<DeployAccountTransaction, 'max_fee'>;
|
|
1257
1257
|
type DeployEstimateFee = DeployTransaction;
|
|
1258
1258
|
type EstimateFeeRequest = InvokeEstimateFee | DeclareEstimateFee | DeployEstimateFee | DeployAccountEstimateFee;
|
|
1259
|
+
type TransactionSimulationResponse = {
|
|
1260
|
+
trace: TransactionTraceResponse;
|
|
1261
|
+
fee_estimation: Sequencer.EstimateFeeResponse;
|
|
1262
|
+
};
|
|
1263
|
+
type SimulateTransaction = Omit<InvokeFunctionTransaction, 'max_fee' | 'entry_point_type'>;
|
|
1259
1264
|
type EstimateFeeResponse = {
|
|
1260
1265
|
overall_fee: number;
|
|
1261
1266
|
gas_price: number;
|
|
1262
1267
|
gas_usage: number;
|
|
1268
|
+
uint: string;
|
|
1263
1269
|
} | {
|
|
1264
1270
|
amount: BN__default;
|
|
1265
1271
|
unit: string;
|
|
@@ -1294,7 +1300,7 @@ declare namespace Sequencer {
|
|
|
1294
1300
|
transactionHash: string;
|
|
1295
1301
|
};
|
|
1296
1302
|
REQUEST: never;
|
|
1297
|
-
RESPONSE:
|
|
1303
|
+
RESPONSE: TransactionTraceResponse;
|
|
1298
1304
|
};
|
|
1299
1305
|
get_transaction_receipt: {
|
|
1300
1306
|
QUERY: {
|
|
@@ -1384,6 +1390,13 @@ declare namespace Sequencer {
|
|
|
1384
1390
|
REQUEST: any;
|
|
1385
1391
|
RESPONSE: EstimateFeeResponse;
|
|
1386
1392
|
};
|
|
1393
|
+
simulate_transaction: {
|
|
1394
|
+
QUERY: {
|
|
1395
|
+
blockIdentifier: BlockIdentifier;
|
|
1396
|
+
};
|
|
1397
|
+
REQUEST: SimulateTransaction;
|
|
1398
|
+
RESPONSE: TransactionSimulationResponse;
|
|
1399
|
+
};
|
|
1387
1400
|
};
|
|
1388
1401
|
}
|
|
1389
1402
|
|
|
@@ -1725,8 +1738,9 @@ declare class SequencerProvider implements ProviderInterface {
|
|
|
1725
1738
|
* @param txHash
|
|
1726
1739
|
* @returns the transaction trace
|
|
1727
1740
|
*/
|
|
1728
|
-
getTransactionTrace(txHash: BigNumberish): Promise<
|
|
1741
|
+
getTransactionTrace(txHash: BigNumberish): Promise<TransactionTraceResponse>;
|
|
1729
1742
|
estimateMessageFee({ from_address, to_address, entry_point_selector, payload }: CallL1Handler, blockIdentifier?: BlockIdentifier): Promise<Sequencer.EstimateFeeResponse>;
|
|
1743
|
+
simulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<Sequencer.TransactionSimulationResponse>;
|
|
1730
1744
|
}
|
|
1731
1745
|
|
|
1732
1746
|
interface ProviderOptions {
|
|
@@ -2684,4 +2698,4 @@ declare function validateChecksumAddress(address: string): boolean;
|
|
|
2684
2698
|
declare function isUrl(s?: string): boolean;
|
|
2685
2699
|
declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: string): string;
|
|
2686
2700
|
|
|
2687
|
-
export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractFactory, ContractFunction, ContractInterface, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployContractPayload, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeDetails, EstimateFeeResponse, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse,
|
|
2701
|
+
export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractFactory, ContractFunction, ContractInterface, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployContractPayload, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeDetails, EstimateFeeResponse, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HttpError, Invocation, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, KeyPair, MessageToL1, MessageToL2, MultiDeployContractResponse, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerProvider, SequencerProviderOptions, Signature, Signer, SignerInterface, Status, Struct, StructAbi, TransactionStatus, TransactionTraceResponse, TransactionType, UniversalDeployerContractPayload, addAddressPadding, buildUrl, constants, defaultProvider, ellipticCurve as ec, encode, getChecksumAddress, hash, isUrl, json, merkle, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress };
|
package/dist/index.global.js
CHANGED
|
@@ -20792,7 +20792,7 @@ var starknet = (() => {
|
|
|
20792
20792
|
calldata: parseCalldata(functionInvocation.calldata),
|
|
20793
20793
|
type: "INVOKE",
|
|
20794
20794
|
max_fee: toHex(toBN(details.maxFee || 0)),
|
|
20795
|
-
version: toHex(toBN(details.version ||
|
|
20795
|
+
version: toHex(toBN(details.version || 1)),
|
|
20796
20796
|
signature: bigNumberishArrayToHexadecimalStringArray(functionInvocation.signature || []),
|
|
20797
20797
|
nonce: toHex(toBN(details.nonce))
|
|
20798
20798
|
}
|
|
@@ -21118,7 +21118,8 @@ var starknet = (() => {
|
|
|
21118
21118
|
"add_transaction",
|
|
21119
21119
|
"call_contract",
|
|
21120
21120
|
"estimate_fee",
|
|
21121
|
-
"estimate_message_fee"
|
|
21121
|
+
"estimate_message_fee",
|
|
21122
|
+
"simulate_transaction"
|
|
21122
21123
|
];
|
|
21123
21124
|
return postMethodEndpoints.includes(endpoint) ? "POST" : "GET";
|
|
21124
21125
|
}
|
|
@@ -21363,6 +21364,20 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
21363
21364
|
};
|
|
21364
21365
|
return this.fetchEndpoint("estimate_message_fee", { blockIdentifier }, validCallL1Handler);
|
|
21365
21366
|
}
|
|
21367
|
+
async simulateTransaction(invocation, invocationDetails, blockIdentifier = this.blockIdentifier) {
|
|
21368
|
+
return this.fetchEndpoint(
|
|
21369
|
+
"simulate_transaction",
|
|
21370
|
+
{ blockIdentifier },
|
|
21371
|
+
{
|
|
21372
|
+
type: "INVOKE_FUNCTION",
|
|
21373
|
+
contract_address: invocation.contractAddress,
|
|
21374
|
+
calldata: invocation.calldata ?? [],
|
|
21375
|
+
signature: bigNumberishArrayToDecimalStringArray(invocation.signature || []),
|
|
21376
|
+
version: toHex(toBN((invocationDetails == null ? void 0 : invocationDetails.version) || 1)),
|
|
21377
|
+
nonce: toHex(toBN(invocationDetails.nonce))
|
|
21378
|
+
}
|
|
21379
|
+
);
|
|
21380
|
+
}
|
|
21366
21381
|
};
|
|
21367
21382
|
|
|
21368
21383
|
// src/provider/default.ts
|