@account-kit/privy-integration 4.73.1-alpha.0 → 4.73.1-alpha.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.
@@ -20,9 +20,64 @@ export const reactNativeAdapter = {
20
20
  const { user } = usePrivy();
21
21
  return { authenticated: !!user, user };
22
22
  },
23
- // EIP-7702 authorization not available on React Native
24
23
  useAuthorizationSigner() {
25
- return null;
24
+ const { wallets } = useEmbeddedEthereumWallet();
25
+ return useCallback(async (unsignedAuth) => {
26
+ const wallet = wallets?.[0];
27
+ if (!wallet) {
28
+ throw new Error("Privy embedded wallet not found. Please ensure the user is authenticated and has created a wallet.");
29
+ }
30
+ const provider = await wallet.getProvider?.();
31
+ if (!provider) {
32
+ throw new Error("Provider not available on this wallet. Ensure you're using the embedded Ethereum wallet.");
33
+ }
34
+ // Extract the implementation address (handle both 'address' and 'contractAddress' fields)
35
+ const implementationAddress = unsignedAuth.address ?? unsignedAuth.contractAddress;
36
+ if (!implementationAddress) {
37
+ throw new Error("Implementation address is required for EIP-7702 authorization");
38
+ }
39
+ // EIP-7702 Authorization structure
40
+ const authorization = {
41
+ domain: {
42
+ name: "EIP-7702",
43
+ version: "1",
44
+ chainId: unsignedAuth.chainId,
45
+ },
46
+ types: {
47
+ Authorization: [
48
+ { name: "chainId", type: "uint256" },
49
+ { name: "address", type: "address" },
50
+ { name: "nonce", type: "uint256" },
51
+ ],
52
+ },
53
+ primaryType: "Authorization",
54
+ message: {
55
+ chainId: unsignedAuth.chainId,
56
+ address: implementationAddress,
57
+ nonce: unsignedAuth.nonce,
58
+ },
59
+ };
60
+ const signature = (await provider.request({
61
+ method: "eth_signTypedData_v4",
62
+ params: [wallet.address, JSON.stringify(authorization)],
63
+ }));
64
+ // Parse the signature into r, s, v components
65
+ // Signature format: 0x[r(64)][s(64)][v(2)]
66
+ const r = `0x${signature.slice(2, 66)}`;
67
+ const s = `0x${signature.slice(66, 130)}`;
68
+ const v = parseInt(signature.slice(130, 132), 16);
69
+ // Convert v to yParity (0 or 1)
70
+ // v can be 27/28 (legacy) or 0/1 (EIP-155)
71
+ const yParity = v >= 27 ? v - 27 : v;
72
+ return {
73
+ chainId: unsignedAuth.chainId,
74
+ address: implementationAddress,
75
+ nonce: unsignedAuth.nonce,
76
+ r,
77
+ s,
78
+ yParity,
79
+ };
80
+ }, [wallets]);
26
81
  },
27
82
  };
28
83
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../src/adapters/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EACL,QAAQ,EACR,yBAAyB,GAE1B,MAAM,gBAAgB,CAAC;AAaxB;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,iBAAiB;QACf,MAAM,EAAE,OAAO,EAAE,GAAG,yBAAyB,EAAE,CAAC;QAEhD,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAmB,EAAE;YACzD,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAC;YACJ,CAAC;YAED,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAEd,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,YAAY;QACV,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC5B,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC;IAED,uDAAuD;IACvD,sBAAsB;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAS,eAAe,CAAC,MAA0B;IACjD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAwB;QACxC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,GAAG;QAC9B,mBAAmB,EAAE,KAAK,IAAI,EAAE;YAC9B,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback } from \"react\";\nimport {\n usePrivy,\n useEmbeddedEthereumWallet,\n type PrivyEmbeddedWalletProvider,\n} from \"@privy-io/expo\";\nimport type { PrivyAdapter, EmbeddedWallet, PrivyAuthState } from \"./types.js\";\n\n/**\n * Wallet type from @privy-io/expo\n * Based on the example app structure\n */\ninterface ExpoEmbeddedWallet {\n address: string;\n chainId?: string;\n getProvider?: () => Promise<PrivyEmbeddedWalletProvider>;\n}\n\n/**\n * React Native (Expo) adapter for @privy-io/expo\n * Implements platform-specific hooks for React Native applications\n */\nexport const reactNativeAdapter: PrivyAdapter = {\n useEmbeddedWallet() {\n const { wallets } = useEmbeddedEthereumWallet();\n\n const getEmbeddedWallet = useCallback((): EmbeddedWallet => {\n const wallet = wallets?.[0];\n if (!wallet) {\n throw new Error(\n \"Privy embedded wallet not found. Please ensure the user is authenticated and has created a wallet.\",\n );\n }\n\n return adaptExpoWallet(wallet);\n }, [wallets]);\n\n return getEmbeddedWallet;\n },\n\n usePrivyAuth(): PrivyAuthState {\n const { user } = usePrivy();\n return { authenticated: !!user, user };\n },\n\n // EIP-7702 authorization not available on React Native\n useAuthorizationSigner() {\n return null;\n },\n};\n\n/**\n * Adapts an Expo wallet to the common EmbeddedWallet interface\n *\n * @param {ExpoEmbeddedWallet} wallet - The Expo embedded wallet to adapt\n * @returns {EmbeddedWallet} The adapted wallet following the common interface\n */\nfunction adaptExpoWallet(wallet: ExpoEmbeddedWallet): EmbeddedWallet {\n return {\n address: wallet.address as `0x${string}`,\n chainId: wallet.chainId || \"1\",\n getEthereumProvider: async () => {\n if (!wallet.getProvider) {\n throw new Error(\n \"getProvider is not available on this wallet. Ensure you're using the embedded Ethereum wallet.\",\n );\n }\n return await wallet.getProvider();\n },\n };\n}\n"]}
1
+ {"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../src/adapters/react-native.ts"],"names":[],"mappings":"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","sourcesContent":["import { useCallback } from \"react\";\nimport {\n usePrivy,\n useEmbeddedEthereumWallet,\n type PrivyEmbeddedWalletProvider,\n} from \"@privy-io/expo\";\nimport type { Authorization } from \"viem\";\nimport type { AuthorizationRequest } from \"@aa-sdk/core\";\nimport type { PrivyAdapter, EmbeddedWallet, PrivyAuthState } from \"./types.js\";\n\n/**\n * Wallet type from @privy-io/expo\n * Based on the example app structure\n */\ninterface ExpoEmbeddedWallet {\n address: string;\n chainId?: string;\n getProvider?: () => Promise<PrivyEmbeddedWalletProvider>;\n}\n\n/**\n * React Native (Expo) adapter for @privy-io/expo\n * Implements platform-specific hooks for React Native applications\n */\nexport const reactNativeAdapter: PrivyAdapter = {\n useEmbeddedWallet() {\n const { wallets } = useEmbeddedEthereumWallet();\n\n const getEmbeddedWallet = useCallback((): EmbeddedWallet => {\n const wallet = wallets?.[0];\n if (!wallet) {\n throw new Error(\n \"Privy embedded wallet not found. Please ensure the user is authenticated and has created a wallet.\",\n );\n }\n\n return adaptExpoWallet(wallet);\n }, [wallets]);\n\n return getEmbeddedWallet;\n },\n\n usePrivyAuth(): PrivyAuthState {\n const { user } = usePrivy();\n return { authenticated: !!user, user };\n },\n\n useAuthorizationSigner() {\n const { wallets } = useEmbeddedEthereumWallet();\n\n return useCallback(\n async (\n unsignedAuth: AuthorizationRequest<number>,\n ): Promise<Authorization<number, true>> => {\n const wallet = wallets?.[0];\n if (!wallet) {\n throw new Error(\n \"Privy embedded wallet not found. Please ensure the user is authenticated and has created a wallet.\",\n );\n }\n\n const provider = await wallet.getProvider?.();\n if (!provider) {\n throw new Error(\n \"Provider not available on this wallet. Ensure you're using the embedded Ethereum wallet.\",\n );\n }\n\n // Extract the implementation address (handle both 'address' and 'contractAddress' fields)\n const implementationAddress =\n unsignedAuth.address ?? unsignedAuth.contractAddress;\n\n if (!implementationAddress) {\n throw new Error(\n \"Implementation address is required for EIP-7702 authorization\",\n );\n }\n\n // EIP-7702 Authorization structure\n const authorization = {\n domain: {\n name: \"EIP-7702\",\n version: \"1\",\n chainId: unsignedAuth.chainId,\n },\n types: {\n Authorization: [\n { name: \"chainId\", type: \"uint256\" },\n { name: \"address\", type: \"address\" },\n { name: \"nonce\", type: \"uint256\" },\n ],\n },\n primaryType: \"Authorization\" as const,\n message: {\n chainId: unsignedAuth.chainId,\n address: implementationAddress,\n nonce: unsignedAuth.nonce,\n },\n };\n\n const signature = (await provider.request({\n method: \"eth_signTypedData_v4\",\n params: [wallet.address, JSON.stringify(authorization)],\n })) as `0x${string}`;\n\n // Parse the signature into r, s, v components\n // Signature format: 0x[r(64)][s(64)][v(2)]\n const r = `0x${signature.slice(2, 66)}` as `0x${string}`;\n const s = `0x${signature.slice(66, 130)}` as `0x${string}`;\n const v = parseInt(signature.slice(130, 132), 16);\n\n // Convert v to yParity (0 or 1)\n // v can be 27/28 (legacy) or 0/1 (EIP-155)\n const yParity = v >= 27 ? v - 27 : v;\n\n return {\n chainId: unsignedAuth.chainId,\n address: implementationAddress,\n nonce: unsignedAuth.nonce,\n r,\n s,\n yParity,\n };\n },\n [wallets],\n );\n },\n};\n\n/**\n * Adapts an Expo wallet to the common EmbeddedWallet interface\n *\n * @param {ExpoEmbeddedWallet} wallet - The Expo embedded wallet to adapt\n * @returns {EmbeddedWallet} The adapted wallet following the common interface\n */\nfunction adaptExpoWallet(wallet: ExpoEmbeddedWallet): EmbeddedWallet {\n return {\n address: wallet.address as `0x${string}`,\n chainId: wallet.chainId || \"1\",\n getEthereumProvider: async () => {\n if (!wallet.getProvider) {\n throw new Error(\n \"getProvider is not available on this wallet. Ensure you're using the embedded Ethereum wallet.\",\n );\n }\n return await wallet.getProvider();\n },\n };\n}\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.73.1-alpha.0";
1
+ export declare const VERSION = "4.73.1-alpha.1";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.73.1-alpha.0";
3
+ export const VERSION = "4.73.1-alpha.1";
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.73.1-alpha.0\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.73.1-alpha.1\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/adapters/react-native.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,YAAY,CAAC;AAY/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,YA2BhC,CAAC"}
1
+ {"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/adapters/react-native.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,YAAY,CAAC;AAY/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,YAuGhC,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.73.1-alpha.0";
1
+ export declare const VERSION = "4.73.1-alpha.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/privy-integration",
3
- "version": "4.73.1-alpha.0",
3
+ "version": "4.73.1-alpha.1",
4
4
  "description": "Use Alchemy gas sponsorship, swaps and more with Privy",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -54,8 +54,8 @@
54
54
  "typescript-template": "*"
55
55
  },
56
56
  "dependencies": {
57
- "@account-kit/infra": "^4.73.1-alpha.0",
58
- "@account-kit/wallet-client": "^4.73.1-alpha.0"
57
+ "@account-kit/infra": "^4.73.1-alpha.1",
58
+ "@account-kit/wallet-client": "^4.73.1-alpha.1"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@privy-io/expo": "^0.58.0",
@@ -85,5 +85,5 @@
85
85
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
86
86
  },
87
87
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
88
- "gitHead": "30a05bddab1215d0ba101fcdcdec63894d14c04d"
88
+ "gitHead": "03b2f5bff3d97e39f0be09eeaa6eb1f5a51631c6"
89
89
  }
@@ -4,6 +4,8 @@ import {
4
4
  useEmbeddedEthereumWallet,
5
5
  type PrivyEmbeddedWalletProvider,
6
6
  } from "@privy-io/expo";
7
+ import type { Authorization } from "viem";
8
+ import type { AuthorizationRequest } from "@aa-sdk/core";
7
9
  import type { PrivyAdapter, EmbeddedWallet, PrivyAuthState } from "./types.js";
8
10
 
9
11
  /**
@@ -43,9 +45,85 @@ export const reactNativeAdapter: PrivyAdapter = {
43
45
  return { authenticated: !!user, user };
44
46
  },
45
47
 
46
- // EIP-7702 authorization not available on React Native
47
48
  useAuthorizationSigner() {
48
- return null;
49
+ const { wallets } = useEmbeddedEthereumWallet();
50
+
51
+ return useCallback(
52
+ async (
53
+ unsignedAuth: AuthorizationRequest<number>,
54
+ ): Promise<Authorization<number, true>> => {
55
+ const wallet = wallets?.[0];
56
+ if (!wallet) {
57
+ throw new Error(
58
+ "Privy embedded wallet not found. Please ensure the user is authenticated and has created a wallet.",
59
+ );
60
+ }
61
+
62
+ const provider = await wallet.getProvider?.();
63
+ if (!provider) {
64
+ throw new Error(
65
+ "Provider not available on this wallet. Ensure you're using the embedded Ethereum wallet.",
66
+ );
67
+ }
68
+
69
+ // Extract the implementation address (handle both 'address' and 'contractAddress' fields)
70
+ const implementationAddress =
71
+ unsignedAuth.address ?? unsignedAuth.contractAddress;
72
+
73
+ if (!implementationAddress) {
74
+ throw new Error(
75
+ "Implementation address is required for EIP-7702 authorization",
76
+ );
77
+ }
78
+
79
+ // EIP-7702 Authorization structure
80
+ const authorization = {
81
+ domain: {
82
+ name: "EIP-7702",
83
+ version: "1",
84
+ chainId: unsignedAuth.chainId,
85
+ },
86
+ types: {
87
+ Authorization: [
88
+ { name: "chainId", type: "uint256" },
89
+ { name: "address", type: "address" },
90
+ { name: "nonce", type: "uint256" },
91
+ ],
92
+ },
93
+ primaryType: "Authorization" as const,
94
+ message: {
95
+ chainId: unsignedAuth.chainId,
96
+ address: implementationAddress,
97
+ nonce: unsignedAuth.nonce,
98
+ },
99
+ };
100
+
101
+ const signature = (await provider.request({
102
+ method: "eth_signTypedData_v4",
103
+ params: [wallet.address, JSON.stringify(authorization)],
104
+ })) as `0x${string}`;
105
+
106
+ // Parse the signature into r, s, v components
107
+ // Signature format: 0x[r(64)][s(64)][v(2)]
108
+ const r = `0x${signature.slice(2, 66)}` as `0x${string}`;
109
+ const s = `0x${signature.slice(66, 130)}` as `0x${string}`;
110
+ const v = parseInt(signature.slice(130, 132), 16);
111
+
112
+ // Convert v to yParity (0 or 1)
113
+ // v can be 27/28 (legacy) or 0/1 (EIP-155)
114
+ const yParity = v >= 27 ? v - 27 : v;
115
+
116
+ return {
117
+ chainId: unsignedAuth.chainId,
118
+ address: implementationAddress,
119
+ nonce: unsignedAuth.nonce,
120
+ r,
121
+ s,
122
+ yParity,
123
+ };
124
+ },
125
+ [wallets],
126
+ );
49
127
  },
50
128
  };
51
129
 
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.73.1-alpha.0";
3
+ export const VERSION = "4.73.1-alpha.1";