@spicenet-io/spiceflow-ui 1.9.32 → 1.9.34
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.js +24 -19
- package/dist/index.js +18 -13
- package/package.json +8 -8
package/dist/index.cjs.js
CHANGED
|
@@ -10,7 +10,7 @@ const Button = require('./Button-D2yFTia-.js');
|
|
|
10
10
|
const reactDom = require('react-dom');
|
|
11
11
|
const reactAuth = require('@privy-io/react-auth');
|
|
12
12
|
const sdkReactCore = require('@dynamic-labs/sdk-react-core');
|
|
13
|
-
const
|
|
13
|
+
const spiceflowCore = require('@spicenet-io/spiceflow-core');
|
|
14
14
|
const wagmi = require('wagmi');
|
|
15
15
|
const authDynamic = require('./auth-dynamic.cjs.js');
|
|
16
16
|
const authPrivy = require('./auth-privy.cjs.js');
|
|
@@ -3620,7 +3620,7 @@ const SwapWidget = ({
|
|
|
3620
3620
|
for (const chainId of uniqueChainIds) {
|
|
3621
3621
|
const client = getClientForChain(chainId);
|
|
3622
3622
|
const delegateContract = getDelegateContractAddress(chainId);
|
|
3623
|
-
const nonce = await
|
|
3623
|
+
const nonce = await spiceflowCore.getAccountNonce(
|
|
3624
3624
|
address,
|
|
3625
3625
|
client
|
|
3626
3626
|
);
|
|
@@ -3631,17 +3631,18 @@ const SwapWidget = ({
|
|
|
3631
3631
|
});
|
|
3632
3632
|
authorizations.push(auth);
|
|
3633
3633
|
}
|
|
3634
|
-
const hashedChainBatches =
|
|
3635
|
-
const
|
|
3634
|
+
const hashedChainBatches = spiceflowCore.hashChainBatches(allChainBatches);
|
|
3635
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
3636
|
+
const digest = spiceflowCore.getAuthorizationHash(0n, BigInt(exp), hashedChainBatches);
|
|
3636
3637
|
const signatureResult = await actions.signMessage(digest);
|
|
3637
3638
|
const signature = typeof signatureResult === "string" ? signatureResult : signatureResult.signature;
|
|
3638
3639
|
if (!signature) throw new Error("Failed to sign intent authorization");
|
|
3639
3640
|
const intent = {
|
|
3640
3641
|
mode: "7702",
|
|
3641
|
-
signatureType: "
|
|
3642
|
+
signatureType: "ecdsa",
|
|
3642
3643
|
signature,
|
|
3643
3644
|
nbf: 0,
|
|
3644
|
-
exp
|
|
3645
|
+
exp,
|
|
3645
3646
|
chainBatches: hashedChainBatches.map((b) => ({
|
|
3646
3647
|
hash: b.hash,
|
|
3647
3648
|
chainId: Number(b.chainId),
|
|
@@ -5264,21 +5265,21 @@ const DepositWidget = ({
|
|
|
5264
5265
|
const authorizations = [];
|
|
5265
5266
|
for (const chainId of uniqueChainIds) {
|
|
5266
5267
|
const client = getClientForChain(chainId);
|
|
5267
|
-
getDelegateContractAddress(chainId);
|
|
5268
|
-
const nonce = await
|
|
5268
|
+
const delegateContract = getDelegateContractAddress(chainId);
|
|
5269
|
+
const nonce = await spiceflowCore.getAccountNonce(
|
|
5269
5270
|
address,
|
|
5270
5271
|
client
|
|
5271
5272
|
);
|
|
5272
5273
|
const auth = await actions.signAuthorization({
|
|
5273
|
-
contractAddress:
|
|
5274
|
-
// smart account address
|
|
5274
|
+
contractAddress: delegateContract,
|
|
5275
5275
|
chainId,
|
|
5276
5276
|
nonce: Number(nonce)
|
|
5277
5277
|
});
|
|
5278
5278
|
authorizations.push(auth);
|
|
5279
5279
|
}
|
|
5280
|
-
const hashedChainBatches =
|
|
5281
|
-
const
|
|
5280
|
+
const hashedChainBatches = spiceflowCore.hashChainBatches(allChainBatches);
|
|
5281
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
5282
|
+
const digest = spiceflowCore.getAuthorizationHash(0n, BigInt(exp), hashedChainBatches);
|
|
5282
5283
|
const signatureResult = await actions.signMessage(digest);
|
|
5283
5284
|
const signature = typeof signatureResult === "string" ? signatureResult : signatureResult.signature;
|
|
5284
5285
|
if (!signature) throw new Error("Failed to sign intent authorization");
|
|
@@ -5287,8 +5288,7 @@ const DepositWidget = ({
|
|
|
5287
5288
|
signatureType: "ecdsa",
|
|
5288
5289
|
signature,
|
|
5289
5290
|
nbf: 0,
|
|
5290
|
-
exp
|
|
5291
|
-
// 10 minutes from now
|
|
5291
|
+
exp,
|
|
5292
5292
|
chainBatches: hashedChainBatches.map((b) => ({
|
|
5293
5293
|
hash: b.hash,
|
|
5294
5294
|
chainId: b.chainId,
|
|
@@ -9901,25 +9901,30 @@ const DepositModal = React.memo(
|
|
|
9901
9901
|
throw new Error("Address not available");
|
|
9902
9902
|
}
|
|
9903
9903
|
const delegateContract = getDelegateContractAddress(chainId);
|
|
9904
|
-
const nonce = await
|
|
9904
|
+
const nonce = await spiceflowCore.getAccountNonce(address, client);
|
|
9905
9905
|
const auth = await signAuthorization({
|
|
9906
9906
|
contractAddress: delegateContract,
|
|
9907
9907
|
chainId,
|
|
9908
9908
|
nonce: Number(nonce)
|
|
9909
9909
|
});
|
|
9910
|
-
const hashedChainBatches =
|
|
9910
|
+
const hashedChainBatches = spiceflowCore.hashChainBatches(
|
|
9911
9911
|
allChainBatches
|
|
9912
9912
|
);
|
|
9913
|
-
const
|
|
9913
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
9914
|
+
const digest = spiceflowCore.getAuthorizationHash(
|
|
9915
|
+
0n,
|
|
9916
|
+
BigInt(exp),
|
|
9917
|
+
hashedChainBatches
|
|
9918
|
+
);
|
|
9914
9919
|
const intentSignature = await signMessage({ message: digest });
|
|
9915
9920
|
if (!intentSignature)
|
|
9916
9921
|
throw new Error("Failed to sign intent authorization");
|
|
9917
9922
|
const intent = {
|
|
9918
9923
|
mode: "7702",
|
|
9919
|
-
signatureType: "
|
|
9924
|
+
signatureType: "ecdsa",
|
|
9920
9925
|
signature: intentSignature.signature,
|
|
9921
9926
|
nbf: 0,
|
|
9922
|
-
exp
|
|
9927
|
+
exp,
|
|
9923
9928
|
chainBatches: hashedChainBatches.map((hb, idx) => ({
|
|
9924
9929
|
hash: hb.hash,
|
|
9925
9930
|
chainId: allChainBatches[idx].chainId,
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { c as createTheme, B as Button, d as defaultTheme } from './Button-CWjGZ
|
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
import { useWallets, usePrivy, useSign7702Authorization, useSignMessage } from '@privy-io/react-auth';
|
|
10
10
|
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
|
|
11
|
-
import { getAccountNonce, hashChainBatches, getAuthorizationHash } from 'spiceflow-core
|
|
11
|
+
import { getAccountNonce, hashChainBatches, getAuthorizationHash } from '@spicenet-io/spiceflow-core';
|
|
12
12
|
import { useAccount, useWalletClient, useSwitchChain, useReadContracts, useConnect, useDisconnect, http as http$1, createConfig, WagmiProvider } from 'wagmi';
|
|
13
13
|
import { DynamicLogin } from './auth-dynamic.js';
|
|
14
14
|
import { PrivyLogin } from './auth-privy.js';
|
|
@@ -3630,16 +3630,17 @@ const SwapWidget = ({
|
|
|
3630
3630
|
authorizations.push(auth);
|
|
3631
3631
|
}
|
|
3632
3632
|
const hashedChainBatches = hashChainBatches(allChainBatches);
|
|
3633
|
-
const
|
|
3633
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
3634
|
+
const digest = getAuthorizationHash(0n, BigInt(exp), hashedChainBatches);
|
|
3634
3635
|
const signatureResult = await actions.signMessage(digest);
|
|
3635
3636
|
const signature = typeof signatureResult === "string" ? signatureResult : signatureResult.signature;
|
|
3636
3637
|
if (!signature) throw new Error("Failed to sign intent authorization");
|
|
3637
3638
|
const intent = {
|
|
3638
3639
|
mode: "7702",
|
|
3639
|
-
signatureType: "
|
|
3640
|
+
signatureType: "ecdsa",
|
|
3640
3641
|
signature,
|
|
3641
3642
|
nbf: 0,
|
|
3642
|
-
exp
|
|
3643
|
+
exp,
|
|
3643
3644
|
chainBatches: hashedChainBatches.map((b) => ({
|
|
3644
3645
|
hash: b.hash,
|
|
3645
3646
|
chainId: Number(b.chainId),
|
|
@@ -5262,21 +5263,21 @@ const DepositWidget = ({
|
|
|
5262
5263
|
const authorizations = [];
|
|
5263
5264
|
for (const chainId of uniqueChainIds) {
|
|
5264
5265
|
const client = getClientForChain(chainId);
|
|
5265
|
-
getDelegateContractAddress(chainId);
|
|
5266
|
+
const delegateContract = getDelegateContractAddress(chainId);
|
|
5266
5267
|
const nonce = await getAccountNonce(
|
|
5267
5268
|
address,
|
|
5268
5269
|
client
|
|
5269
5270
|
);
|
|
5270
5271
|
const auth = await actions.signAuthorization({
|
|
5271
|
-
contractAddress:
|
|
5272
|
-
// smart account address
|
|
5272
|
+
contractAddress: delegateContract,
|
|
5273
5273
|
chainId,
|
|
5274
5274
|
nonce: Number(nonce)
|
|
5275
5275
|
});
|
|
5276
5276
|
authorizations.push(auth);
|
|
5277
5277
|
}
|
|
5278
5278
|
const hashedChainBatches = hashChainBatches(allChainBatches);
|
|
5279
|
-
const
|
|
5279
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
5280
|
+
const digest = getAuthorizationHash(0n, BigInt(exp), hashedChainBatches);
|
|
5280
5281
|
const signatureResult = await actions.signMessage(digest);
|
|
5281
5282
|
const signature = typeof signatureResult === "string" ? signatureResult : signatureResult.signature;
|
|
5282
5283
|
if (!signature) throw new Error("Failed to sign intent authorization");
|
|
@@ -5285,8 +5286,7 @@ const DepositWidget = ({
|
|
|
5285
5286
|
signatureType: "ecdsa",
|
|
5286
5287
|
signature,
|
|
5287
5288
|
nbf: 0,
|
|
5288
|
-
exp
|
|
5289
|
-
// 10 minutes from now
|
|
5289
|
+
exp,
|
|
5290
5290
|
chainBatches: hashedChainBatches.map((b) => ({
|
|
5291
5291
|
hash: b.hash,
|
|
5292
5292
|
chainId: b.chainId,
|
|
@@ -9908,16 +9908,21 @@ const DepositModal = React.memo(
|
|
|
9908
9908
|
const hashedChainBatches = hashChainBatches(
|
|
9909
9909
|
allChainBatches
|
|
9910
9910
|
);
|
|
9911
|
-
const
|
|
9911
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
9912
|
+
const digest = getAuthorizationHash(
|
|
9913
|
+
0n,
|
|
9914
|
+
BigInt(exp),
|
|
9915
|
+
hashedChainBatches
|
|
9916
|
+
);
|
|
9912
9917
|
const intentSignature = await signMessage({ message: digest });
|
|
9913
9918
|
if (!intentSignature)
|
|
9914
9919
|
throw new Error("Failed to sign intent authorization");
|
|
9915
9920
|
const intent = {
|
|
9916
9921
|
mode: "7702",
|
|
9917
|
-
signatureType: "
|
|
9922
|
+
signatureType: "ecdsa",
|
|
9918
9923
|
signature: intentSignature.signature,
|
|
9919
9924
|
nbf: 0,
|
|
9920
|
-
exp
|
|
9925
|
+
exp,
|
|
9921
9926
|
chainBatches: hashedChainBatches.map((hb, idx) => ({
|
|
9922
9927
|
hash: hb.hash,
|
|
9923
9928
|
chainId: allChainBatches[idx].chainId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spicenet-io/spiceflow-ui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.34",
|
|
4
4
|
"description": "Spiceflow UI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"@dynamic-labs/sdk-react-core": ">=3.9.13 <5.0.0",
|
|
76
76
|
"@dynamic-labs/wallet-connector-core": ">=3.9.13 <5.0.0",
|
|
77
77
|
"@privy-io/react-auth": ">=2.24.0 <4.0.0",
|
|
78
|
+
"@spicenet-io/spiceflow-core": "0.1.1",
|
|
78
79
|
"@tanstack/react-query": ">=5.0.0",
|
|
79
80
|
"axios": ">=1.0.0",
|
|
80
81
|
"react": "^18.0.0",
|
|
81
82
|
"react-dom": "^18.0.0",
|
|
82
|
-
"spiceflow-core-test": ">=0.1.0",
|
|
83
83
|
"viem": ">=2.21.0",
|
|
84
84
|
"wagmi": ">=2.12.0"
|
|
85
85
|
},
|
|
@@ -103,41 +103,41 @@
|
|
|
103
103
|
"@dynamic-labs/wallet-connector-core": "^3.9.13",
|
|
104
104
|
"@privy-io/react-auth": "^2.24.0",
|
|
105
105
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
106
|
-
"axios": "^1.11.0",
|
|
107
106
|
"@rollup/plugin-image": "^3.0.3",
|
|
108
107
|
"@rollup/plugin-json": "^6.1.0",
|
|
109
108
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
110
109
|
"@rollup/plugin-replace": "^6.0.2",
|
|
111
110
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
112
|
-
"
|
|
113
|
-
"rollup-plugin-esbuild": "^6.1.1",
|
|
111
|
+
"@spicenet-io/spiceflow-core": "0.1.1",
|
|
114
112
|
"@tanstack/react-query": "^5.90.5",
|
|
115
113
|
"@types/node": "^24.3.0",
|
|
116
114
|
"@types/react": "^18.3.3",
|
|
117
115
|
"@types/react-dom": "^18.3.0",
|
|
118
116
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
119
117
|
"@typescript-eslint/parser": "^6.0.0",
|
|
118
|
+
"axios": "^1.11.0",
|
|
119
|
+
"esbuild": "^0.24.0",
|
|
120
120
|
"eslint": "^8.45.0",
|
|
121
121
|
"eslint-config-prettier": "^10.1.8",
|
|
122
122
|
"eslint-plugin-react": "^7.33.0",
|
|
123
123
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
124
124
|
"husky": "^9.1.7",
|
|
125
125
|
"lint-staged": "^16.2.5",
|
|
126
|
+
"lucide-react": "^0.562.0",
|
|
126
127
|
"postcss": "^8.5.6",
|
|
127
128
|
"postcss-import": "^16.1.1",
|
|
128
129
|
"prettier": "3.6.2",
|
|
129
|
-
"jest": "^29.6.0",
|
|
130
130
|
"react": "^18.3.1",
|
|
131
131
|
"react-dom": "^18.3.1",
|
|
132
132
|
"rollup": "^4.50.0",
|
|
133
133
|
"rollup-plugin-copy": "^3.5.0",
|
|
134
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
|
134
135
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
135
136
|
"rollup-plugin-postcss": "^4.0.2",
|
|
136
137
|
"ts-node": "^10.9.2",
|
|
137
138
|
"typescript": "^5.9.2",
|
|
138
139
|
"viem": "2.33.1",
|
|
139
|
-
"wagmi": "^2.18.2"
|
|
140
|
-
"spiceflow-core-test": "^0.1.0"
|
|
140
|
+
"wagmi": "^2.18.2"
|
|
141
141
|
},
|
|
142
142
|
"lint-staged": {
|
|
143
143
|
"*.{ts,tsx,js,jsx,json,md}": "prettier --write"
|