@spicenet-io/spiceflow-ui 1.9.32 → 1.9.33
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 +22 -16
- package/dist/index.js +16 -10
- 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),
|
|
@@ -5265,7 +5266,7 @@ const DepositWidget = ({
|
|
|
5265
5266
|
for (const chainId of uniqueChainIds) {
|
|
5266
5267
|
const client = getClientForChain(chainId);
|
|
5267
5268
|
getDelegateContractAddress(chainId);
|
|
5268
|
-
const nonce = await
|
|
5269
|
+
const nonce = await spiceflowCore.getAccountNonce(
|
|
5269
5270
|
address,
|
|
5270
5271
|
client
|
|
5271
5272
|
);
|
|
@@ -5277,8 +5278,9 @@ const DepositWidget = ({
|
|
|
5277
5278
|
});
|
|
5278
5279
|
authorizations.push(auth);
|
|
5279
5280
|
}
|
|
5280
|
-
const hashedChainBatches =
|
|
5281
|
-
const
|
|
5281
|
+
const hashedChainBatches = spiceflowCore.hashChainBatches(allChainBatches);
|
|
5282
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
5283
|
+
const digest = spiceflowCore.getAuthorizationHash(0n, BigInt(exp), hashedChainBatches);
|
|
5282
5284
|
const signatureResult = await actions.signMessage(digest);
|
|
5283
5285
|
const signature = typeof signatureResult === "string" ? signatureResult : signatureResult.signature;
|
|
5284
5286
|
if (!signature) throw new Error("Failed to sign intent authorization");
|
|
@@ -5287,8 +5289,7 @@ const DepositWidget = ({
|
|
|
5287
5289
|
signatureType: "ecdsa",
|
|
5288
5290
|
signature,
|
|
5289
5291
|
nbf: 0,
|
|
5290
|
-
exp
|
|
5291
|
-
// 10 minutes from now
|
|
5292
|
+
exp,
|
|
5292
5293
|
chainBatches: hashedChainBatches.map((b) => ({
|
|
5293
5294
|
hash: b.hash,
|
|
5294
5295
|
chainId: b.chainId,
|
|
@@ -9901,25 +9902,30 @@ const DepositModal = React.memo(
|
|
|
9901
9902
|
throw new Error("Address not available");
|
|
9902
9903
|
}
|
|
9903
9904
|
const delegateContract = getDelegateContractAddress(chainId);
|
|
9904
|
-
const nonce = await
|
|
9905
|
+
const nonce = await spiceflowCore.getAccountNonce(address, client);
|
|
9905
9906
|
const auth = await signAuthorization({
|
|
9906
9907
|
contractAddress: delegateContract,
|
|
9907
9908
|
chainId,
|
|
9908
9909
|
nonce: Number(nonce)
|
|
9909
9910
|
});
|
|
9910
|
-
const hashedChainBatches =
|
|
9911
|
+
const hashedChainBatches = spiceflowCore.hashChainBatches(
|
|
9911
9912
|
allChainBatches
|
|
9912
9913
|
);
|
|
9913
|
-
const
|
|
9914
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
9915
|
+
const digest = spiceflowCore.getAuthorizationHash(
|
|
9916
|
+
0n,
|
|
9917
|
+
BigInt(exp),
|
|
9918
|
+
hashedChainBatches
|
|
9919
|
+
);
|
|
9914
9920
|
const intentSignature = await signMessage({ message: digest });
|
|
9915
9921
|
if (!intentSignature)
|
|
9916
9922
|
throw new Error("Failed to sign intent authorization");
|
|
9917
9923
|
const intent = {
|
|
9918
9924
|
mode: "7702",
|
|
9919
|
-
signatureType: "
|
|
9925
|
+
signatureType: "ecdsa",
|
|
9920
9926
|
signature: intentSignature.signature,
|
|
9921
9927
|
nbf: 0,
|
|
9922
|
-
exp
|
|
9928
|
+
exp,
|
|
9923
9929
|
chainBatches: hashedChainBatches.map((hb, idx) => ({
|
|
9924
9930
|
hash: hb.hash,
|
|
9925
9931
|
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),
|
|
@@ -5276,7 +5277,8 @@ const DepositWidget = ({
|
|
|
5276
5277
|
authorizations.push(auth);
|
|
5277
5278
|
}
|
|
5278
5279
|
const hashedChainBatches = hashChainBatches(allChainBatches);
|
|
5279
|
-
const
|
|
5280
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
5281
|
+
const digest = getAuthorizationHash(0n, BigInt(exp), hashedChainBatches);
|
|
5280
5282
|
const signatureResult = await actions.signMessage(digest);
|
|
5281
5283
|
const signature = typeof signatureResult === "string" ? signatureResult : signatureResult.signature;
|
|
5282
5284
|
if (!signature) throw new Error("Failed to sign intent authorization");
|
|
@@ -5285,8 +5287,7 @@ const DepositWidget = ({
|
|
|
5285
5287
|
signatureType: "ecdsa",
|
|
5286
5288
|
signature,
|
|
5287
5289
|
nbf: 0,
|
|
5288
|
-
exp
|
|
5289
|
-
// 10 minutes from now
|
|
5290
|
+
exp,
|
|
5290
5291
|
chainBatches: hashedChainBatches.map((b) => ({
|
|
5291
5292
|
hash: b.hash,
|
|
5292
5293
|
chainId: b.chainId,
|
|
@@ -9908,16 +9909,21 @@ const DepositModal = React.memo(
|
|
|
9908
9909
|
const hashedChainBatches = hashChainBatches(
|
|
9909
9910
|
allChainBatches
|
|
9910
9911
|
);
|
|
9911
|
-
const
|
|
9912
|
+
const exp = Math.floor(Date.now() / 1e3) + 60 * 10;
|
|
9913
|
+
const digest = getAuthorizationHash(
|
|
9914
|
+
0n,
|
|
9915
|
+
BigInt(exp),
|
|
9916
|
+
hashedChainBatches
|
|
9917
|
+
);
|
|
9912
9918
|
const intentSignature = await signMessage({ message: digest });
|
|
9913
9919
|
if (!intentSignature)
|
|
9914
9920
|
throw new Error("Failed to sign intent authorization");
|
|
9915
9921
|
const intent = {
|
|
9916
9922
|
mode: "7702",
|
|
9917
|
-
signatureType: "
|
|
9923
|
+
signatureType: "ecdsa",
|
|
9918
9924
|
signature: intentSignature.signature,
|
|
9919
9925
|
nbf: 0,
|
|
9920
|
-
exp
|
|
9926
|
+
exp,
|
|
9921
9927
|
chainBatches: hashedChainBatches.map((hb, idx) => ({
|
|
9922
9928
|
hash: hb.hash,
|
|
9923
9929
|
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.33",
|
|
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"
|