decane-connect-kit 2.3.0 → 2.3.1
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 +19 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -28
- package/dist/index.d.ts +31 -28
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2787,7 +2787,7 @@ async function signEvmAuthorization(tee, chainId, address, nonce, jwt) {
|
|
|
2787
2787
|
const r = "0x" + hex.slice(0, 64);
|
|
2788
2788
|
const s = "0x" + hex.slice(64, 128);
|
|
2789
2789
|
const v = parseInt(hex.slice(128, 130), 16);
|
|
2790
|
-
return { yParity: v >= 27 ? v - 27 : v, r, s };
|
|
2790
|
+
return { chainId, address, nonce, yParity: v >= 27 ? v - 27 : v, r, s };
|
|
2791
2791
|
}
|
|
2792
2792
|
async function signEvmTypedData(tee, chain, typedData, jwt) {
|
|
2793
2793
|
const payload = JSON.stringify(
|
|
@@ -2948,9 +2948,6 @@ function createEthereumProvider(client, opts = {}) {
|
|
|
2948
2948
|
}
|
|
2949
2949
|
case "eth_signAuthorization":
|
|
2950
2950
|
case "wallet_sign7702Authorization": {
|
|
2951
|
-
if (!client.signAuthorization) {
|
|
2952
|
-
throw Object.assign(new Error("EIP-7702 is not supported by the connected signer."), { code: 4200 });
|
|
2953
|
-
}
|
|
2954
2951
|
const p = params[0];
|
|
2955
2952
|
const cid = p.chainId != null ? Number(asBigInt(p.chainId)) : chainId;
|
|
2956
2953
|
const address = p.address ?? p.contractAddress;
|
|
@@ -3804,7 +3801,16 @@ async function createDecaneConnect(config) {
|
|
|
3804
3801
|
},
|
|
3805
3802
|
async signAuthorization(req) {
|
|
3806
3803
|
const tee = session.requireActive();
|
|
3807
|
-
|
|
3804
|
+
const delegate = req.address ?? req.contractAddress;
|
|
3805
|
+
if (!delegate) throw new CallSequenceError("signAuthorization requires `address` (the delegate contract).");
|
|
3806
|
+
return signEvmAuthorization(tee, req.chainId, delegate, req.nonce, auth?.jwt);
|
|
3807
|
+
},
|
|
3808
|
+
// The current session's access token (the Decane JWT), for authenticating
|
|
3809
|
+
// the user to your own backend — e.g. a sponsored-bundler proxy. Verify it
|
|
3810
|
+
// server-side against https://backend.decane.app/.well-known/jwks.json.
|
|
3811
|
+
// Null when there is no live session.
|
|
3812
|
+
getAccessToken() {
|
|
3813
|
+
return auth?.jwt ?? null;
|
|
3808
3814
|
},
|
|
3809
3815
|
getEthereumProvider(opts) {
|
|
3810
3816
|
if (!ethProvider) {
|
|
@@ -6026,6 +6032,9 @@ function DecaneKit({ config, children }) {
|
|
|
6026
6032
|
},
|
|
6027
6033
|
[]
|
|
6028
6034
|
);
|
|
6035
|
+
const socialGetAccessToken = (0, import_react5.useCallback)(() => {
|
|
6036
|
+
return socialRef.current?.getAccessToken() ?? null;
|
|
6037
|
+
}, []);
|
|
6029
6038
|
const socialGetBalances = (0, import_react5.useCallback)(async () => {
|
|
6030
6039
|
const sdk = socialRef.current;
|
|
6031
6040
|
if (!sdk) throw new Error("Social wallet not connected");
|
|
@@ -6090,6 +6099,7 @@ function DecaneKit({ config, children }) {
|
|
|
6090
6099
|
socialGetBalances,
|
|
6091
6100
|
socialGetEthereumProvider,
|
|
6092
6101
|
socialSignAuthorization,
|
|
6102
|
+
socialGetAccessToken,
|
|
6093
6103
|
socialSignSolanaTransaction,
|
|
6094
6104
|
socialSignTypedData,
|
|
6095
6105
|
socialRotateShares,
|
|
@@ -6314,6 +6324,7 @@ function useSocialWallet() {
|
|
|
6314
6324
|
socialGetBalances,
|
|
6315
6325
|
socialGetEthereumProvider,
|
|
6316
6326
|
socialSignAuthorization,
|
|
6327
|
+
socialGetAccessToken,
|
|
6317
6328
|
socialRotateShares,
|
|
6318
6329
|
socialExportPortableBackup,
|
|
6319
6330
|
socialHasRecoveryShare,
|
|
@@ -6439,6 +6450,9 @@ function useSocialWallet() {
|
|
|
6439
6450
|
signAuthorization,
|
|
6440
6451
|
// An EIP-1193 provider for viem/wagmi/ethers (memoized).
|
|
6441
6452
|
getEthereumProvider: socialGetEthereumProvider,
|
|
6453
|
+
// The Decane JWT — authenticate the user to your own backend (bundler proxy,
|
|
6454
|
+
// etc.); verify server-side against backend.decane.app/.well-known/jwks.json.
|
|
6455
|
+
getAccessToken: socialGetAccessToken,
|
|
6442
6456
|
// Recovery (2-of-3 Shamir share set)
|
|
6443
6457
|
rotateShares,
|
|
6444
6458
|
exportPortableBackup,
|