@argent/x-shared 1.74.1 → 1.75.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/dist/index.cjs +1 -1
- package/dist/index.js +212 -209
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +5 -5
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +13 -14
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +3 -3
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +3 -3
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +1 -1
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +6 -6
- package/dist/src/chains/starknet/address.cjs +1 -1
- package/dist/src/chains/starknet/address.js +17 -17
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +1 -1
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +1 -1
- package/dist/src/features/defiDecomposition/helpers/computeCollateralizedDebtPositionsUsdValue.cjs +1 -1
- package/dist/src/features/defiDecomposition/helpers/computeCollateralizedDebtPositionsUsdValue.js +27 -27
- package/dist/src/features/defiDecomposition/helpers/computeConcentratedLiquidityPositionsUsdValue.cjs +1 -1
- package/dist/src/features/defiDecomposition/helpers/computeConcentratedLiquidityPositionsUsdValue.js +22 -22
- package/dist/src/features/defiDecomposition/helpers/computeDelegatedTokensPositionsUsdValue.cjs +1 -1
- package/dist/src/features/defiDecomposition/helpers/computeDelegatedTokensPositionsUsdValue.js +14 -14
- package/dist/src/features/defiDecomposition/helpers/computeStakingPositionsUsdValue.cjs +1 -1
- package/dist/src/features/defiDecomposition/helpers/computeStakingPositionsUsdValue.js +9 -9
- package/dist/src/features/defiDecomposition/helpers/computeStrkDelegatedStakingPositionsUsdValue.cjs +1 -1
- package/dist/src/features/defiDecomposition/helpers/computeStrkDelegatedStakingPositionsUsdValue.js +13 -13
- package/dist/src/features/defiDecomposition/helpers/parseCollateralizedDebtPositions.cjs +1 -1
- package/dist/src/features/defiDecomposition/helpers/parseCollateralizedDebtPositions.js +24 -25
- package/dist/src/features/simulation/activity/normalize.cjs +1 -1
- package/dist/src/features/simulation/activity/normalize.js +12 -13
- package/dist/src/features/simulation/activity/schema.cjs +1 -1
- package/dist/src/features/simulation/activity/schema.js +6 -6
- package/dist/src/features/simulation/activity/utils/createNativeActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/createNativeActivity.js +22 -24
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.js +11 -12
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.js +2 -8
- package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.js +4 -8
- package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.js +4 -8
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.js +3 -9
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.js +15 -19
- package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.js +4 -8
- package/dist/src/features/simulation/activity/utils/isSwapActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isSwapActivity.js +9 -16
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +4 -8
- package/dist/src/features/simulation/fees/schema.cjs +1 -1
- package/dist/src/features/simulation/fees/schema.d.ts +16 -0
- package/dist/src/features/simulation/fees/schema.js +8 -6
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.cjs +1 -1
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.js +10 -11
- package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
- package/dist/src/features/simulation/transactionReview/schema.d.ts +23 -0
- package/dist/src/features/simulation/transactionReview/schema.js +21 -19
- package/dist/src/features/swap/services/SwapTransactionService.cjs +1 -1
- package/dist/src/features/swap/services/SwapTransactionService.js +46 -49
- package/dist/src/http/HttpService.cjs +1 -1
- package/dist/src/http/HttpService.js +55 -55
- package/dist/src/knownDapps/utils/getDapplandUrl.cjs +1 -1
- package/dist/src/knownDapps/utils/getDapplandUrl.js +6 -8
- package/dist/src/nfts/BackendNftService.cjs +1 -1
- package/dist/src/nfts/BackendNftService.js +18 -19
- package/dist/src/tokens/service/implementation.cjs +1 -1
- package/dist/src/tokens/service/implementation.js +12 -12
- package/dist/src/tokens/service/types/backend.model.js +1 -1
- package/dist/src/transactions/estimate/utils.cjs +1 -1
- package/dist/src/transactions/estimate/utils.d.ts +33 -0
- package/dist/src/transactions/estimate/utils.js +80 -76
- package/dist/src/transactions/service/implementation.cjs +1 -1
- package/dist/src/transactions/service/implementation.d.ts +4 -0
- package/dist/src/transactions/service/implementation.js +89 -96
- package/dist/src/transactions/service/utils.cjs +1 -1
- package/dist/src/transactions/service/utils.d.ts +2 -3
- package/dist/src/transactions/service/utils.js +12 -11
- package/dist/src/transactions/transactionVersion.cjs +1 -1
- package/dist/src/transactions/transactionVersion.d.ts +2 -0
- package/dist/src/transactions/transactionVersion.js +12 -10
- package/dist/src/utils/base58.js +5 -5
- package/dist/src/utils/number/abbreviateNumber.d.ts +2 -1
- package/dist/src/utils/readFileAsString.cjs +1 -1
- package/dist/src/utils/readFileAsString.js +3 -6
- package/package.json +23 -23
- package/dist/node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.cjs +0 -1
- package/dist/node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.js +0 -6
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { ReviewError as
|
|
4
|
-
import { getPayloadFromTransaction as
|
|
5
|
-
import { urlWithQuery as
|
|
6
|
-
import { simulateAndReviewSchema as
|
|
7
|
-
import { getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2 as
|
|
8
|
-
import { ensureArray as
|
|
9
|
-
class
|
|
1
|
+
import { TransactionType as p } from "starknet";
|
|
2
|
+
import d from "url-join";
|
|
3
|
+
import { ReviewError as l } from "../../errors/review.js";
|
|
4
|
+
import { getPayloadFromTransaction as w } from "./utils.js";
|
|
5
|
+
import { urlWithQuery as C } from "../../utils/url/urlWithQuery.js";
|
|
6
|
+
import { simulateAndReviewSchema as y, isTransactionSimulationError as B } from "../../features/simulation/transactionReview/schema.js";
|
|
7
|
+
import { getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2 as F } from "../estimate/utils.js";
|
|
8
|
+
import { ensureArray as x } from "../../utils/arrays.js";
|
|
9
|
+
class D {
|
|
10
10
|
constructor(s, e) {
|
|
11
11
|
this.apiBase = s, this.httpService = e;
|
|
12
12
|
}
|
|
@@ -15,7 +15,7 @@ class B {
|
|
|
15
15
|
* @returns {Promise<TransactionReviewLabel[] | undefined>} The account activities.
|
|
16
16
|
*/
|
|
17
17
|
async getLabels() {
|
|
18
|
-
const s =
|
|
18
|
+
const s = d(this.apiBase, "reviewer", "labels");
|
|
19
19
|
return await this.httpService.get(s);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -23,86 +23,84 @@ class B {
|
|
|
23
23
|
* @returns {Promise<TransactionReviewWarning[] | undefined>} The account activities.
|
|
24
24
|
*/
|
|
25
25
|
async getWarnings() {
|
|
26
|
-
const s =
|
|
26
|
+
const s = d(this.apiBase, "reviewer", "warnings/reasons");
|
|
27
27
|
return await this.httpService.get(s);
|
|
28
28
|
}
|
|
29
|
-
async simulateAndReview(s, e,
|
|
30
|
-
|
|
31
|
-
const i = e.some((a) => a.type === "DEPLOY_ACCOUNT");
|
|
29
|
+
async simulateAndReview(s, e, c, n, i, t) {
|
|
30
|
+
const a = e.some((r) => r.type === "DEPLOY_ACCOUNT");
|
|
32
31
|
try {
|
|
33
32
|
if (!("getChainId" in s))
|
|
34
33
|
throw new Error("MISSING_METHOD");
|
|
35
|
-
const
|
|
36
|
-
transactions: e.map((
|
|
37
|
-
...
|
|
38
|
-
transaction:
|
|
39
|
-
nonce:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
isDeploymentTransaction: i,
|
|
34
|
+
const r = a ? "0x0" : await s.getNonce(), o = await s.getChainId(), _ = {
|
|
35
|
+
transactions: e.map((u) => ({
|
|
36
|
+
...w({
|
|
37
|
+
transaction: u,
|
|
38
|
+
nonce: r,
|
|
39
|
+
chainId: o,
|
|
40
|
+
isDeploymentTransaction: a,
|
|
43
41
|
appDomain: n,
|
|
44
42
|
cairoVersion: s.cairoVersion,
|
|
45
43
|
address: s.address
|
|
46
44
|
}),
|
|
47
|
-
type:
|
|
45
|
+
type: u.type
|
|
48
46
|
}))
|
|
49
|
-
}, g =
|
|
47
|
+
}, g = d(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), h = t ? C(g, { delayedTransactions: "true" }) : g, m = await this.httpService.post(h, {
|
|
50
48
|
headers: {
|
|
51
49
|
Accept: "application/json",
|
|
52
50
|
"Content-Type": "application/json"
|
|
53
51
|
},
|
|
54
|
-
body: JSON.stringify(
|
|
55
|
-
},
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
58
|
-
const
|
|
52
|
+
body: JSON.stringify(_)
|
|
53
|
+
}, y);
|
|
54
|
+
if (m.transactions?.some((u) => B(u)))
|
|
55
|
+
return m;
|
|
56
|
+
const E = F(m);
|
|
59
57
|
return {
|
|
60
|
-
...
|
|
61
|
-
enrichedFeeEstimation:
|
|
58
|
+
...m,
|
|
59
|
+
enrichedFeeEstimation: E
|
|
62
60
|
};
|
|
63
|
-
} catch (
|
|
64
|
-
return console.error(
|
|
61
|
+
} catch (r) {
|
|
62
|
+
return console.error(r), this.fallbackToOnchainFeeEstimation({
|
|
65
63
|
transactions: e,
|
|
66
64
|
account: s,
|
|
67
|
-
isDeploymentTransaction:
|
|
68
|
-
feeTokenAddress:
|
|
69
|
-
accountDeployTransaction:
|
|
65
|
+
isDeploymentTransaction: a,
|
|
66
|
+
feeTokenAddress: c,
|
|
67
|
+
accountDeployTransaction: i
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
getCallsFromTx(s) {
|
|
74
72
|
let e;
|
|
75
|
-
return s.calls && (e =
|
|
73
|
+
return s.calls && (e = x(s.calls)), e;
|
|
76
74
|
}
|
|
77
|
-
async fallbackToOnchainFeeEstimation({ transactions: s, account: e, isDeploymentTransaction:
|
|
75
|
+
async fallbackToOnchainFeeEstimation({ transactions: s, account: e, isDeploymentTransaction: c, feeTokenAddress: n, accountDeployTransaction: i }) {
|
|
78
76
|
try {
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
81
|
-
throw new
|
|
77
|
+
const t = c ? this.getCallsFromTx(s[1]) : this.getCallsFromTx(s[0]);
|
|
78
|
+
if (!t)
|
|
79
|
+
throw new l({
|
|
82
80
|
code: "NO_CALLS_FOUND"
|
|
83
81
|
});
|
|
84
|
-
const
|
|
82
|
+
const a = await this.fetchFeesOnchain({
|
|
85
83
|
starknetAccount: e,
|
|
86
|
-
calls:
|
|
87
|
-
isDeployed: !
|
|
84
|
+
calls: t,
|
|
85
|
+
isDeployed: !c,
|
|
88
86
|
feeTokenAddress: n,
|
|
89
|
-
accountDeployTransaction:
|
|
87
|
+
accountDeployTransaction: i
|
|
90
88
|
});
|
|
91
89
|
return {
|
|
92
90
|
transactions: [],
|
|
93
|
-
enrichedFeeEstimation:
|
|
91
|
+
enrichedFeeEstimation: a,
|
|
94
92
|
isBackendDown: !0
|
|
95
93
|
};
|
|
96
|
-
} catch (
|
|
97
|
-
throw console.error(
|
|
98
|
-
message: `${
|
|
94
|
+
} catch (t) {
|
|
95
|
+
throw console.error(t), new l({
|
|
96
|
+
message: `${t}`,
|
|
99
97
|
code: "SIMULATE_AND_REVIEW_FAILED"
|
|
100
98
|
});
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
|
-
async fetchFeesOnchain({ starknetAccount: s, calls: e, isDeployed:
|
|
101
|
+
async fetchFeesOnchain({ starknetAccount: s, calls: e, isDeployed: c, feeTokenAddress: n, accountDeployTransaction: i }) {
|
|
104
102
|
try {
|
|
105
|
-
const
|
|
103
|
+
const t = {
|
|
106
104
|
type: "native",
|
|
107
105
|
transactions: {
|
|
108
106
|
feeTokenAddress: n,
|
|
@@ -120,97 +118,92 @@ class B {
|
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
};
|
|
123
|
-
if (!
|
|
121
|
+
if (!c && i) {
|
|
124
122
|
if ("estimateFeeBulk" in s) {
|
|
125
|
-
const
|
|
123
|
+
const a = [
|
|
126
124
|
{
|
|
127
|
-
type:
|
|
125
|
+
type: p.DEPLOY_ACCOUNT,
|
|
128
126
|
payload: {
|
|
129
|
-
classHash:
|
|
130
|
-
addressSalt:
|
|
131
|
-
constructorCalldata:
|
|
127
|
+
classHash: i.classHash,
|
|
128
|
+
addressSalt: i.salt,
|
|
129
|
+
constructorCalldata: i.calldata,
|
|
132
130
|
contractAddress: s.address
|
|
133
131
|
}
|
|
134
132
|
},
|
|
135
133
|
{
|
|
136
|
-
type:
|
|
134
|
+
type: p.INVOKE,
|
|
137
135
|
payload: e
|
|
138
136
|
}
|
|
139
|
-
], [
|
|
140
|
-
|
|
141
|
-
}).catch((c) => {
|
|
142
|
-
throw console.error(c), c;
|
|
137
|
+
], [r, o] = await s.estimateFeeBulk(a).catch((_) => {
|
|
138
|
+
throw console.error(_), _;
|
|
143
139
|
});
|
|
144
|
-
if (!
|
|
145
|
-
throw new
|
|
140
|
+
if (!r.resourceBounds.l1_data_gas || !r.resourceBounds.l1_gas || !r.resourceBounds.l2_gas || !o.resourceBounds.l1_data_gas || !o.resourceBounds.l1_gas || !o.resourceBounds.l2_gas)
|
|
141
|
+
throw new l({
|
|
146
142
|
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
147
143
|
message: "Missing gas_consumed or gas_price"
|
|
148
144
|
});
|
|
149
|
-
|
|
145
|
+
t.deployment = {
|
|
150
146
|
feeTokenAddress: n,
|
|
151
147
|
l1Gas: {
|
|
152
|
-
gasConsumed:
|
|
153
|
-
gasPrice:
|
|
148
|
+
gasConsumed: r.resourceBounds.l1_gas.max_amount,
|
|
149
|
+
gasPrice: r.resourceBounds.l1_gas.max_price_per_unit
|
|
154
150
|
},
|
|
155
151
|
l2Gas: {
|
|
156
|
-
gasConsumed:
|
|
157
|
-
gasPrice:
|
|
152
|
+
gasConsumed: r.resourceBounds.l2_gas.max_amount,
|
|
153
|
+
gasPrice: r.resourceBounds.l2_gas.max_price_per_unit
|
|
158
154
|
},
|
|
159
155
|
l1DataGas: {
|
|
160
|
-
gasConsumed:
|
|
161
|
-
gasPrice:
|
|
156
|
+
gasConsumed: r.resourceBounds.l1_data_gas.max_amount,
|
|
157
|
+
gasPrice: r.resourceBounds.l1_data_gas.max_price_per_unit
|
|
162
158
|
}
|
|
163
|
-
},
|
|
159
|
+
}, t.transactions = {
|
|
164
160
|
feeTokenAddress: n,
|
|
165
161
|
l1Gas: {
|
|
166
|
-
gasConsumed:
|
|
167
|
-
gasPrice:
|
|
162
|
+
gasConsumed: o.resourceBounds.l1_gas.max_amount,
|
|
163
|
+
gasPrice: o.resourceBounds.l1_gas.max_price_per_unit
|
|
168
164
|
},
|
|
169
165
|
l2Gas: {
|
|
170
|
-
gasConsumed:
|
|
171
|
-
gasPrice:
|
|
166
|
+
gasConsumed: o.resourceBounds.l2_gas.max_amount,
|
|
167
|
+
gasPrice: o.resourceBounds.l2_gas.max_price_per_unit
|
|
172
168
|
},
|
|
173
169
|
l1DataGas: {
|
|
174
|
-
gasConsumed:
|
|
175
|
-
gasPrice:
|
|
170
|
+
gasConsumed: o.resourceBounds.l1_data_gas.max_amount,
|
|
171
|
+
gasPrice: o.resourceBounds.l1_data_gas.max_price_per_unit
|
|
176
172
|
}
|
|
177
173
|
};
|
|
178
174
|
}
|
|
179
175
|
} else {
|
|
180
|
-
const {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
});
|
|
184
|
-
if (!t || !g || !d || !c)
|
|
185
|
-
throw new m({
|
|
176
|
+
const { resourceBounds: a } = await s.estimateInvokeFee(e);
|
|
177
|
+
if (!a.l1_gas || !a.l2_gas || !a.l1_data_gas)
|
|
178
|
+
throw new l({
|
|
186
179
|
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
187
180
|
message: "Missing gas_consumed or gas_price"
|
|
188
181
|
});
|
|
189
|
-
|
|
182
|
+
t.transactions = {
|
|
190
183
|
feeTokenAddress: n,
|
|
191
184
|
l1Gas: {
|
|
192
|
-
gasConsumed:
|
|
193
|
-
gasPrice:
|
|
185
|
+
gasConsumed: a.l1_gas.max_amount,
|
|
186
|
+
gasPrice: a.l1_gas.max_price_per_unit
|
|
194
187
|
},
|
|
195
188
|
l2Gas: {
|
|
196
|
-
gasConsumed:
|
|
197
|
-
gasPrice:
|
|
189
|
+
gasConsumed: a.l2_gas.max_amount,
|
|
190
|
+
gasPrice: a.l2_gas.max_price_per_unit
|
|
198
191
|
},
|
|
199
192
|
l1DataGas: {
|
|
200
|
-
gasConsumed: a,
|
|
201
|
-
gasPrice:
|
|
193
|
+
gasConsumed: a.l1_data_gas.max_amount,
|
|
194
|
+
gasPrice: a.l1_data_gas.max_price_per_unit
|
|
202
195
|
}
|
|
203
196
|
};
|
|
204
197
|
}
|
|
205
|
-
return [
|
|
206
|
-
} catch (
|
|
207
|
-
throw new
|
|
198
|
+
return [t];
|
|
199
|
+
} catch (t) {
|
|
200
|
+
throw new l({
|
|
208
201
|
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
209
|
-
message: `${
|
|
202
|
+
message: `${t}`
|
|
210
203
|
});
|
|
211
204
|
}
|
|
212
205
|
}
|
|
213
206
|
}
|
|
214
207
|
export {
|
|
215
|
-
|
|
208
|
+
D as TransactionReviewServiceWeb
|
|
216
209
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("starknet"),i=require("../../utils/arrays.cjs"),y=require("../transactionVersion.cjs"),d=({transaction:e,nonce:r,chainId:s,isDeploymentTransaction:t,cairoVersion:l,address:o,appDomain:c})=>{let a=r;t&&e.type!=="DEPLOY_ACCOUNT"&&(a=u.num.toHex(1));const n=i.ensureArray(e.calls);return{type:e.type,chainId:s,cairoVersion:l,nonce:a,version:y.TX_VERSION,account:o,calls:n,calldata:e.calldata,salt:e.salt,signature:e.signature,classHash:e.classHash,appDomain:c}};exports.getPayloadFromTransaction=d;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { CairoVersion } from 'starknet';
|
|
2
2
|
import { TransactionReviewTransactions } from '../estimate';
|
|
3
|
-
export declare const getPayloadFromTransaction: ({ transaction, nonce, chainId,
|
|
3
|
+
export declare const getPayloadFromTransaction: ({ transaction, nonce, chainId, isDeploymentTransaction, cairoVersion, address, appDomain, }: {
|
|
4
4
|
transaction: TransactionReviewTransactions;
|
|
5
5
|
nonce: string;
|
|
6
6
|
chainId: string;
|
|
7
|
-
version: string;
|
|
8
7
|
isDeploymentTransaction: boolean;
|
|
9
8
|
cairoVersion: CairoVersion;
|
|
10
9
|
address: string;
|
|
@@ -14,7 +13,7 @@ export declare const getPayloadFromTransaction: ({ transaction, nonce, chainId,
|
|
|
14
13
|
chainId: string;
|
|
15
14
|
cairoVersion: CairoVersion;
|
|
16
15
|
nonce: string;
|
|
17
|
-
version:
|
|
16
|
+
version: "0x3";
|
|
18
17
|
account: string;
|
|
19
18
|
calls: import('starknet').Call[];
|
|
20
19
|
calldata: string[] | undefined;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { num as
|
|
2
|
-
import { ensureArray as
|
|
3
|
-
|
|
1
|
+
import { num as p } from "starknet";
|
|
2
|
+
import { ensureArray as u } from "../../utils/arrays.js";
|
|
3
|
+
import { TX_VERSION as y } from "../transactionVersion.js";
|
|
4
|
+
const g = ({ transaction: e, nonce: a, chainId: o, isDeploymentTransaction: r, cairoVersion: s, address: t, appDomain: c }) => {
|
|
4
5
|
let l = a;
|
|
5
|
-
|
|
6
|
-
const
|
|
6
|
+
r && e.type !== "DEPLOY_ACCOUNT" && (l = p.toHex(1));
|
|
7
|
+
const m = u(e.calls);
|
|
7
8
|
return {
|
|
8
9
|
type: e.type,
|
|
9
|
-
chainId:
|
|
10
|
-
cairoVersion:
|
|
10
|
+
chainId: o,
|
|
11
|
+
cairoVersion: s,
|
|
11
12
|
nonce: l,
|
|
12
|
-
version:
|
|
13
|
-
account:
|
|
14
|
-
calls:
|
|
13
|
+
version: y,
|
|
14
|
+
account: t,
|
|
15
|
+
calls: m,
|
|
15
16
|
calldata: e.calldata,
|
|
16
17
|
salt: e.salt,
|
|
17
18
|
signature: e.signature,
|
|
18
19
|
classHash: e.classHash,
|
|
19
|
-
appDomain:
|
|
20
|
+
appDomain: c
|
|
20
21
|
// appDomain: "https://starknetkit-blacked-listed.vercel.app", // to simulate blacklisted domain
|
|
21
22
|
};
|
|
22
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("starknet"),o=require("zod"),s=[n.ETransactionVersion3.V3,n.ETransactionVersion3.F3],i=o.z.string().default("0x3").refine(t=>{const e=n.num.toBigInt(t);return s.map(r=>n.num.toBigInt(r)).includes(e)}).transform(t=>n.num.toHex(t));exports.txVersionSchema=i;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("starknet"),o=require("zod"),s=[n.ETransactionVersion3.V3,n.ETransactionVersion3.F3],i=o.z.string().default("0x3").refine(t=>{const e=n.num.toBigInt(t);return s.map(r=>n.num.toBigInt(r)).includes(e)}).transform(t=>n.num.toHex(t)),c="0x3",a="0x100000000000000000000000000000003";exports.FEE_TX_VERSION=a;exports.TX_VERSION=c;exports.txVersionSchema=i;
|
|
@@ -5,3 +5,5 @@ export type TransactionInvokeVersion = typeof ETransactionVersion3.V3;
|
|
|
5
5
|
export type TransactionSimulationVersion = typeof ETransactionVersion3.F3;
|
|
6
6
|
export type TransactionVersion = TransactionInvokeVersion | TransactionSimulationVersion;
|
|
7
7
|
export declare const txVersionSchema: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<"0x3" | "0x100000000000000000000000000000003", string>>;
|
|
8
|
+
export declare const TX_VERSION: "0x3";
|
|
9
|
+
export declare const FEE_TX_VERSION: "0x100000000000000000000000000000003";
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { num as t, ETransactionVersion3 as
|
|
2
|
-
import { z as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
],
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
}).transform((n) => t.toHex(n));
|
|
1
|
+
import { num as t, ETransactionVersion3 as o } from "starknet";
|
|
2
|
+
import { z as e } from "zod";
|
|
3
|
+
const i = [
|
|
4
|
+
o.V3,
|
|
5
|
+
o.F3
|
|
6
|
+
], a = e.string().default("0x3").refine((n) => {
|
|
7
|
+
const r = t.toBigInt(n);
|
|
8
|
+
return i.map((s) => t.toBigInt(s)).includes(r);
|
|
9
|
+
}).transform((n) => t.toHex(n)), x = "0x3", V = "0x100000000000000000000000000000003";
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
V as FEE_TX_VERSION,
|
|
12
|
+
x as TX_VERSION,
|
|
13
|
+
a as txVersionSchema
|
|
12
14
|
};
|
package/dist/src/utils/base58.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hex as r, base58 as c } from "@scure/base";
|
|
2
2
|
import { encode as n, num as s } from "starknet";
|
|
3
3
|
const a = (e) => {
|
|
4
|
-
const o = n.removeHexPrefix(n.sanitizeHex(s.toHex(e))), t =
|
|
5
|
-
return
|
|
4
|
+
const o = n.removeHexPrefix(n.sanitizeHex(s.toHex(e))), t = r.decode(o);
|
|
5
|
+
return c.encode(t);
|
|
6
6
|
}, m = (e) => e.map(a), d = (e) => {
|
|
7
|
-
const o =
|
|
8
|
-
return n.sanitizeHex(
|
|
7
|
+
const o = c.decode(e);
|
|
8
|
+
return n.sanitizeHex(r.encode(o));
|
|
9
9
|
}, i = (e) => e.map(d);
|
|
10
10
|
export {
|
|
11
11
|
d as decodeBase58,
|
|
@@ -10,4 +10,5 @@ import { BigNumberish } from 'starknet';
|
|
|
10
10
|
* abbreviateNumber("1,234,567") // "1.23M"
|
|
11
11
|
* abbreviateNumber(1234567890) // "1.23B"
|
|
12
12
|
*/
|
|
13
|
-
export declare const abbreviateNumber: (value?: BigNumberish, groupSeparator?: string,
|
|
13
|
+
export declare const abbreviateNumber: (value?: BigNumberish, groupSeparator?: string, // for string input, default is ","
|
|
14
|
+
digitsAfterDecimal?: number) => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=n=>new Promise((o,e)=>{const r=new FileReader;r.onload=()=>r.result?o(r.result?.toString()):e(new Error("Could not read file")),r.onerror=e,r.onabort=e.bind(null,new Error("User aborted")),r.readAsText(n)});exports.readFileAsString=t;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = (n) => new Promise((o, e) => {
|
|
2
2
|
const r = new FileReader();
|
|
3
|
-
r.onload = () =>
|
|
4
|
-
var n;
|
|
5
|
-
return r.result ? t((n = r.result) == null ? void 0 : n.toString()) : e(new Error("Could not read file"));
|
|
6
|
-
}, r.onerror = e, r.onabort = e.bind(null, new Error("User aborted")), r.readAsText(o);
|
|
3
|
+
r.onload = () => r.result ? o(r.result?.toString()) : e(new Error("Could not read file")), r.onerror = e, r.onabort = e.bind(null, new Error("User aborted")), r.readAsText(n);
|
|
7
4
|
});
|
|
8
5
|
export {
|
|
9
|
-
|
|
6
|
+
t as readFileAsString
|
|
10
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argent/x-shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.75.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/argentlabs/x-shared.git"
|
|
@@ -55,34 +55,34 @@
|
|
|
55
55
|
"i18n:upload": "node --loader ts-node/esm --experimental-specifier-resolution=node --no-warnings src/scripts/upload-translation.ts"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@amplitude/analytics-types": "2.
|
|
59
|
-
"@commitlint/cli": "19.
|
|
60
|
-
"@commitlint/config-conventional": "19.
|
|
58
|
+
"@amplitude/analytics-types": "2.9.1",
|
|
59
|
+
"@commitlint/cli": "19.8.0",
|
|
60
|
+
"@commitlint/config-conventional": "19.8.0",
|
|
61
61
|
"@rollup/plugin-typescript": "12.1.2",
|
|
62
62
|
"@semantic-release/git": "10.0.1",
|
|
63
63
|
"@types/async-retry": "1.4.9",
|
|
64
64
|
"@types/lodash-es": "4.17.12",
|
|
65
65
|
"@types/numeral": "2.0.5",
|
|
66
66
|
"@types/ua-parser-js": "0.7.39",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
68
|
-
"@typescript-eslint/parser": "8.
|
|
69
|
-
"esbuild": "
|
|
70
|
-
"esbuild-register": "
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "8.29.0",
|
|
68
|
+
"@typescript-eslint/parser": "8.29.0",
|
|
69
|
+
"esbuild": "0.25.2",
|
|
70
|
+
"esbuild-register": "3.6.0",
|
|
71
71
|
"eslint": "8.57.1",
|
|
72
|
-
"eslint-config-prettier": "10.
|
|
72
|
+
"eslint-config-prettier": "10.1.1",
|
|
73
73
|
"eslint-plugin-import": "2.31.0",
|
|
74
74
|
"husky": "9.1.7",
|
|
75
|
-
"lint-staged": "
|
|
76
|
-
"msw": "2.7.
|
|
77
|
-
"prettier": "3.
|
|
78
|
-
"semantic-release": "24.2.
|
|
79
|
-
"ts-node": "
|
|
75
|
+
"lint-staged": "16.1.2",
|
|
76
|
+
"msw": "2.7.3",
|
|
77
|
+
"prettier": "3.5.3",
|
|
78
|
+
"semantic-release": "24.2.3",
|
|
79
|
+
"ts-node": "10.9.2",
|
|
80
80
|
"ts-to-zod": "3.15.0",
|
|
81
|
-
"tsx": "
|
|
82
|
-
"typescript": "5.
|
|
83
|
-
"vite": "
|
|
84
|
-
"vite-plugin-dts": "4.5.
|
|
85
|
-
"vitest": "3.
|
|
81
|
+
"tsx": "4.19.3",
|
|
82
|
+
"typescript": "5.8.3",
|
|
83
|
+
"vite": "7.0.6",
|
|
84
|
+
"vite-plugin-dts": "4.5.3",
|
|
85
|
+
"vitest": "3.1.1"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@argent/x-multicall": "^7.1.0",
|
|
@@ -90,16 +90,16 @@
|
|
|
90
90
|
"@langchain/google-genai": "^0.2.2",
|
|
91
91
|
"@lokalise/node-api": "^15.0.0",
|
|
92
92
|
"@noble/hashes": "^1.3.1",
|
|
93
|
-
"@starknet-io/types-js": "
|
|
93
|
+
"@starknet-io/types-js": "0.9.0-beta.5",
|
|
94
94
|
"@types/fs-extra": "^11.0.4",
|
|
95
95
|
"big-decimal-number": "npm:bignumber.js@^9.1.2",
|
|
96
|
-
"dotenv": "^
|
|
96
|
+
"dotenv": "^17.0.0",
|
|
97
97
|
"fs-extra": "^11.3.0",
|
|
98
|
-
"i18next": "^
|
|
98
|
+
"i18next": "^25.0.0",
|
|
99
99
|
"micro-starknet": "^0.2.3",
|
|
100
100
|
"numeral": "2.0.6",
|
|
101
101
|
"react-i18next": "^15.4.1",
|
|
102
|
-
"starknet": "
|
|
102
|
+
"starknet": "8.1.2",
|
|
103
103
|
"starknet4-deprecated": "npm:starknet@4.4.0",
|
|
104
104
|
"starknet5": "npm:starknet@5.25.0",
|
|
105
105
|
"zod-to-json-schema": "^3.24.5"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={V1:"0x1"};exports.ETransactionVersion=e;
|