Skip to content

Commit e369fe2

Browse files
docs: expand v7 migration guide (#1368)
--------- Co-authored-by: Petar Penovic <[email protected]>
1 parent e77fcc7 commit e369fe2

File tree

1 file changed

+102
-1
lines changed

1 file changed

+102
-1
lines changed

www/docs/guides/migrate.md

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,105 @@ const provider = new RpcProvider({
2323
});
2424
```
2525

26-
## ...
26+
## Rpc compatibility
27+
28+
Starknet.js v6 is compatible with Starknet RPC **0.6** and **0.7** nodes.
29+
30+
Starknet.js v7 drops support for RPC **0.6**, and introduces support for RPC **0.8**, it supports RPC **0.7** and **0.8** nodes.
31+
32+
By default, Starknet.js v7 uses RPC **0.8** with **V3** transactions (STRK fees). This means that you can no longer execute **V1** transactions (ETH fees) by default.
33+
34+
| | RPC 0.7 | RPC 0.8 <br /> (default) |
35+
| ----------------: | :------: | :----------------------: |
36+
| V1 tx (ETH fees) | Possible | Impossible |
37+
| V3 tx (STRK fees) | Default | Default |
38+
39+
You can configure your code to use RPC **0.7** with ETH and STRK fees available by using the following options:
40+
41+
- Define `specVersion: '0.7'` when instantiating an RpcProvider
42+
- Use `config.set('legacyMode', true)` to enable **V1** transactions
43+
- Use `logger.setLogLevel('ERROR')` if you want to remove the warnings when processing **V1** transactions
44+
45+
```typescript
46+
import { RpcProvider, Account, config, logger, ETransactionVersion } from 'starknet';
47+
48+
const myProvider = new RpcProvider({
49+
nodeUrl: 'https://free-rpc.nethermind.io/sepolia-juno/v0_7',
50+
specVersion: '0.7',
51+
});
52+
53+
config.set('legacyMode', true);
54+
55+
logger.setLogLevel('ERROR');
56+
```
57+
58+
With the above settings the code still uses **V3** transactions with RPC **0.7** by default. To utilize **V1** transactions there are two approaches:
59+
60+
- either configure it at the `Account` instance level by setting the appropriate constructor parameter:
61+
62+
```typescript
63+
const account0 = new Account(
64+
myProvider,
65+
accountAddress0,
66+
privateKey0,
67+
undefined,
68+
ETransactionVersion.V2
69+
);
70+
```
71+
72+
- or configure it for individual method invocations by setting the corresponding options parameter property:
73+
74+
```typescript
75+
const res = await account0.execute(myCall, { version: 1 });
76+
```
77+
78+
## Transaction receipt
79+
80+
In the `ReceiptTx` class, the status [`isRejected`](https://starknetjs.com/docs/6.23.1/API/classes/ReceiptTx#isrejected) has been removed.
81+
82+
## Removed deprecated functionalities
83+
84+
### RpcProvider
85+
86+
| method | replacement |
87+
| :-------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88+
| [`getPendingTransactions(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#getpendingtransactions) | [`getBlockWithTxHashes(BlockTag.PENDING)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#getblockwithtxhashes)<br/>[`getBlock(BlockTag.PENDING)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#getblock) |
89+
| [`getEstimateFee(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#getestimatefee) | [`getInvokeEstimateFee(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#getinvokeestimatefee)<br/>[`getDeclareEstimateFee(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#getdeclareestimatefee)<br/>[`getDeployAccountEstimateFee(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#getdeployaccountestimatefee) |
90+
91+
### Account
92+
93+
| method | details |
94+
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95+
| [`execute(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Account#execute) | The deprecated [`execute(transactions, abis?, transactionsDetail?)`](https://starknetjs.com/docs/6.23.1/API/classes/Account#parameters-20) override with the optional (and unused) `abis` parameter has been removed.<br/><br/> [`execute(transactions, transactionsDetail?)`](https://starknetjs.com/docs/6.23.1/API/classes/Account#parameters-19) now only accepts two parameters and should be used as such. |
96+
| [`verifyMessage(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Account#verifymessage) <br/><br/> [`verifyMessageHash(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Account#verifymessagehash) | The deprecated `Account` message verification methods have been removed. <br/><br/> The `RpcProvider` [`verifyMessageInStarknet(...)`](https://starknetjs.com/docs/6.23.1/API/classes/Provider#verifymessageinstarknet) method should be used instead. |
97+
98+
### WalletAccount
99+
100+
When initializing a `WalletAccount` instance through the constructor [`new WalletAccount(...)`](https://starknetjs.com/docs/6.23.1/API/classes/WalletAccount#constructor) the `address` parameter has been made mandatory with the deprecated eager address retrieval removed.
101+
102+
To initialize a `WalletAccount` instance [`WalletAccount.connect(...)`](https://starknetjs.com/docs/6.23.1/API/classes/WalletAccount#connect) should be used.
103+
104+
### Removed namespace
105+
106+
The `number` namespace alias has been removed in favor of `num` as noted in the v5 migration guide.
107+
108+
### Removed utility functions
109+
110+
| namespace | function | replacement |
111+
| :-----------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------: |
112+
| `encode` | [`stringToArrayBuffer(...)`](https://starknetjs.com/docs/6.23.1/API/namespaces/encode#stringtoarraybuffer) | [`utf8ToArray(...)`](https://starknetjs.com/docs/next/API/namespaces/encode#utf8toarray) |
113+
| `json` | [`stringifyAlwaysAsBig(...)`](https://starknetjs.com/docs/6.23.1/API/namespaces/json#stringifyalwaysasbig) | [`stringify(...)`](https://starknetjs.com/docs/next/API/namespaces/json#stringify) |
114+
| `stark` | [`makeAddress(...)`](https://starknetjs.com/docs/6.23.1/API/namespaces/stark#makeaddress) | [`validateAndParseAddress(...)`](https://starknetjs.com/docs/next/API/modules#validateandparseaddress) |
115+
| `transaction` | [`fromCallsToExecuteCalldataWithNonce(...)`](https://starknetjs.com/docs/6.23.1/API/namespaces/transaction#fromcallstoexecutecalldatawithnonce) <br/> [`transformCallsToMulticallArrays_cairo1(...)`](https://starknetjs.com/docs/6.23.1/API/namespaces/transaction#transformcallstomulticallarrays_cairo1) | / |
116+
117+
- the [`CallStruct`](https://starknetjs.com/docs/6.23.1/API/interfaces/types.CallStruct) type that was used by the `transaction` methods has also been removed
118+
119+
### Removed type alias exports
120+
121+
Multiple TypeScript types have had their old location re-exports removed. They are no longer available within their old namespace but are available as direct imports: `import { *type* } from 'starknet'`.
122+
123+
| namespace | type |
124+
| :---------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
125+
| `num` | [`BigNumberish`](https://starknetjs.com/docs/6.23.1/API/namespaces/num#bignumberish) |
126+
| `typedData` | [`TypedDataRevision`](https://starknetjs.com/docs/6.23.1/API/namespaces/typedData#typeddatarevision) <br/> [`StarknetEnumType`](https://starknetjs.com/docs/6.23.1/API/namespaces/typedData#starknetenumtype) <br/> [`StarknetMerkleType`](https://starknetjs.com/docs/6.23.1/API/namespaces/typedData#starknetmerkletype) <br/> [`StarknetType`](https://starknetjs.com/docs/6.23.1/API/namespaces/typedData#starknettype) <br/> [`StarknetDomain`](https://starknetjs.com/docs/6.23.1/API/namespaces/typedData#starknetdomain) <br/> [`TypedData`](https://starknetjs.com/docs/6.23.1/API/namespaces/typedData#typeddata) |
127+
| `uint256` | [`UINT_128_MAX`](https://starknetjs.com/docs/6.23.1/API/namespaces/uint256#uint_128_max) <br/> [`UINT_256_MAX`](https://starknetjs.com/docs/6.23.1/API/namespaces/uint256#uint_256_max) |

0 commit comments

Comments
 (0)