kokio-sdk 0.1.2 → 0.1.4

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.
Files changed (78) hide show
  1. package/{src/abis/BeaconProxy.json → dist/esm/abis/BeaconProxy.js} +3 -2
  2. package/dist/esm/abis/DeviceWallet.js +913 -0
  3. package/{src/abis/DeviceWalletFactory.json → dist/esm/abis/DeviceWalletFactory.js} +3 -2
  4. package/{src/abis/ESIMWallet.json → dist/esm/abis/ESIMWallet.js} +3 -2
  5. package/{src/abis/ESIMWalletFactory.json → dist/esm/abis/ESIMWalletFactory.js} +3 -2
  6. package/{src/abis/LazyWalletRegistry.json → dist/esm/abis/LazyWalletRegistry.js} +3 -2
  7. package/{src/abis/P256Verifier.json → dist/esm/abis/P256Verifier.js} +3 -2
  8. package/{src/abis/Registry.json → dist/esm/abis/Registry.js} +3 -2
  9. package/{src/abis/RegistryHelper.json → dist/esm/abis/RegistryHelper.js} +3 -2
  10. package/dist/esm/abis/index.js +10 -0
  11. package/dist/esm/config.js +52 -0
  12. package/dist/esm/interface/P256VerifierClass.js +10 -0
  13. package/dist/esm/interface/constantsClass.js +38 -0
  14. package/{src/interface/deviceWalletClass.ts → dist/esm/interface/deviceWalletClass.js} +12 -36
  15. package/dist/esm/interface/deviceWalletFactoryClass.js +18 -0
  16. package/dist/esm/interface/eSIMWalletClass.js +33 -0
  17. package/dist/esm/interface/eSIMWalletFactoryClass.js +21 -0
  18. package/dist/esm/interface/lazyWalletRegistryClass.js +19 -0
  19. package/{src/interface/smartAccountClass.ts → dist/esm/interface/smartAccountClass.js} +3 -11
  20. package/dist/esm/interface/utilsClass.js +13 -0
  21. package/{src/logic/P256Verifier.ts → dist/esm/logic/P256Verifier.js} +6 -17
  22. package/dist/esm/logic/account-kit/createSmartAccount.js +298 -0
  23. package/{src/logic/constants.ts → dist/esm/logic/constants.js} +42 -103
  24. package/{src/logic/deviceWallet.ts → dist/esm/logic/deviceWallet.js} +46 -74
  25. package/{src/logic/deviceWalletFactory.ts → dist/esm/logic/deviceWalletFactory.js} +22 -43
  26. package/{src/logic/eSIMWallet.ts → dist/esm/logic/eSIMWallet.js} +41 -59
  27. package/{src/logic/eSIMWalletFactory.ts → dist/esm/logic/eSIMWalletFactory.js} +28 -41
  28. package/{src/logic/lazyWalletRegistry.ts → dist/esm/logic/lazyWalletRegistry.js} +29 -60
  29. package/dist/esm/logic/utils.js +100 -0
  30. package/dist/esm/types-export.js +1 -0
  31. package/dist/esm/types.js +1 -0
  32. package/dist/types/abis/BeaconProxy.d.ts +3 -0
  33. package/dist/types/abis/DeviceWallet.d.ts +3 -0
  34. package/dist/types/abis/DeviceWalletFactory.d.ts +3 -0
  35. package/dist/types/abis/ESIMWallet.d.ts +3 -0
  36. package/dist/types/abis/ESIMWalletFactory.d.ts +3 -0
  37. package/dist/types/abis/LazyWalletRegistry.d.ts +3 -0
  38. package/dist/types/abis/P256Verifier.d.ts +3 -0
  39. package/dist/types/abis/Registry.d.ts +3 -0
  40. package/dist/types/abis/RegistryHelper.d.ts +3 -0
  41. package/dist/types/abis/index.d.ts +10 -0
  42. package/dist/types/config.d.ts +37 -0
  43. package/dist/types/interface/P256VerifierClass.d.ts +7 -0
  44. package/dist/types/interface/constantsClass.d.ts +27 -0
  45. package/dist/types/interface/deviceWalletClass.d.ts +2577 -0
  46. package/dist/types/interface/deviceWalletFactoryClass.d.ts +2570 -0
  47. package/dist/types/interface/eSIMWalletClass.d.ts +16 -0
  48. package/dist/types/interface/eSIMWalletFactoryClass.d.ts +2571 -0
  49. package/dist/types/interface/lazyWalletRegistryClass.d.ts +11 -0
  50. package/dist/types/interface/smartAccountClass.d.ts +2574 -0
  51. package/dist/types/interface/utilsClass.d.ts +2567 -0
  52. package/dist/types/logic/P256Verifier.d.ts +3 -0
  53. package/dist/types/logic/account-kit/createSmartAccount.d.ts +6 -0
  54. package/dist/types/logic/constants.d.ts +32 -0
  55. package/dist/types/logic/deviceWallet.d.ts +12 -0
  56. package/dist/types/logic/deviceWalletFactory.d.ts +5 -0
  57. package/dist/types/logic/eSIMWallet.d.ts +11 -0
  58. package/dist/types/logic/eSIMWalletFactory.d.ts +6 -0
  59. package/dist/types/logic/lazyWalletRegistry.d.ts +7 -0
  60. package/dist/types/logic/utils.d.ts +18 -0
  61. package/dist/types/types-export.d.ts +1 -0
  62. package/{src/types.ts → dist/types/types.d.ts} +19 -21
  63. package/package.json +24 -14
  64. package/.github/workflows/npm_publish.yaml +0 -45
  65. package/src/abis/DeviceWallet.json +0 -912
  66. package/src/abis/index.ts +0 -21
  67. package/src/config.ts +0 -58
  68. package/src/interface/P256VerifierClass.ts +0 -19
  69. package/src/interface/constantsClass.ts +0 -36
  70. package/src/interface/deviceWalletFactoryClass.ts +0 -35
  71. package/src/interface/eSIMWalletClass.ts +0 -55
  72. package/src/interface/eSIMWalletFactoryClass.ts +0 -36
  73. package/src/interface/lazyWalletRegistryClass.ts +0 -34
  74. package/src/interface/utilsClass.ts +0 -21
  75. package/src/logic/account-kit/createSmartAccount.ts +0 -401
  76. package/src/logic/utils.ts +0 -123
  77. package/src/types-export.ts +0 -7
  78. package/tsconfig.json +0 -114
@@ -1,17 +1,13 @@
1
- import { Address, createPublicClient, encodeFunctionData, getContract, PublicClient, WalletClient } from "viem";
2
- import { SmartAccountClient } from "@aa-sdk/core";
1
+ import { encodeFunctionData, getContract } from "viem";
3
2
  import { DeviceWallet } from "../abis/index.js";
4
3
  import { customErrors } from "./constants.js";
5
- import { P256Key } from "../types.js";
6
-
7
- export const _deployESIMWallet = async (client: SmartAccountClient, address: Address, hasAccessToETH: boolean, salt: bigint) => {
8
-
9
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET);
10
-
4
+ export const _deployESIMWallet = async (client, address, hasAccessToETH, salt) => {
5
+ if (!client.account)
6
+ throw new Error(customErrors.MISSING_SMART_WALLET);
11
7
  // UserOp
12
8
  return client.sendUserOperation({
13
9
  account: client.account,
14
- uo:{
10
+ uo: {
15
11
  target: address,
16
12
  data: encodeFunctionData({
17
13
  abi: DeviceWallet,
@@ -20,21 +16,14 @@ export const _deployESIMWallet = async (client: SmartAccountClient, address: Add
20
16
  })
21
17
  }
22
18
  });
23
- }
24
-
25
- export const _setESIMUniqueIdentifierForAnESIMWallet = async (
26
- client: SmartAccountClient,
27
- address: Address,
28
- eSIMWalletAddress: Address,
29
- eSIMUniqueIdentifier: string
30
- ) => {
31
-
32
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET);
33
-
19
+ };
20
+ export const _setESIMUniqueIdentifierForAnESIMWallet = async (client, address, eSIMWalletAddress, eSIMUniqueIdentifier) => {
21
+ if (!client.account)
22
+ throw new Error(customErrors.MISSING_SMART_WALLET);
34
23
  // UserOp
35
24
  return client.sendUserOperation({
36
25
  account: client.account,
37
- uo:{
26
+ uo: {
38
27
  target: address,
39
28
  data: encodeFunctionData({
40
29
  abi: DeviceWallet,
@@ -44,18 +33,15 @@ export const _setESIMUniqueIdentifierForAnESIMWallet = async (
44
33
  }
45
34
  });
46
35
  // const contract = (await getContractInstance(client)).deviceWallet(address);
47
-
48
36
  // return contract.write.setESIMUniqueIdentifierForAnESIMWallet([eSIMWalletAddress, eSIMUniqueIdentifier]);
49
- }
50
-
51
- export const _payETHForDataBundles = async (client: SmartAccountClient, address: Address, amount: bigint) => {
52
-
53
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
54
-
37
+ };
38
+ export const _payETHForDataBundles = async (client, address, amount) => {
39
+ if (!client.account)
40
+ throw new Error(customErrors.MISSING_SMART_WALLET);
55
41
  // UserOp
56
42
  return client.sendUserOperation({
57
43
  account: client.account,
58
- uo:{
44
+ uo: {
59
45
  target: address,
60
46
  data: encodeFunctionData({
61
47
  abi: DeviceWallet,
@@ -64,16 +50,14 @@ export const _payETHForDataBundles = async (client: SmartAccountClient, address:
64
50
  })
65
51
  }
66
52
  });
67
- }
68
-
69
- export const _pullETH = async (client: SmartAccountClient, address: Address, amount: bigint) => {
70
-
71
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET);
72
-
53
+ };
54
+ export const _pullETH = async (client, address, amount) => {
55
+ if (!client.account)
56
+ throw new Error(customErrors.MISSING_SMART_WALLET);
73
57
  // UserOp
74
58
  return client.sendUserOperation({
75
59
  account: client.account,
76
- uo:{
60
+ uo: {
77
61
  target: address,
78
62
  data: encodeFunctionData({
79
63
  abi: DeviceWallet,
@@ -82,16 +66,14 @@ export const _pullETH = async (client: SmartAccountClient, address: Address, amo
82
66
  })
83
67
  }
84
68
  });
85
- }
86
-
87
- export const _getVaultAddress = async (client: SmartAccountClient, address: Address) => {
88
-
89
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET);
90
-
69
+ };
70
+ export const _getVaultAddress = async (client, address) => {
71
+ if (!client.account)
72
+ throw new Error(customErrors.MISSING_SMART_WALLET);
91
73
  // UserOp
92
74
  return client.sendUserOperation({
93
75
  account: client.account,
94
- uo:{
76
+ uo: {
95
77
  target: address,
96
78
  data: encodeFunctionData({
97
79
  abi: DeviceWallet,
@@ -100,16 +82,14 @@ export const _getVaultAddress = async (client: SmartAccountClient, address: Addr
100
82
  })
101
83
  }
102
84
  });
103
- }
104
-
105
- export const _toggleAccessToETH = async (client: SmartAccountClient, address: Address, eSIMWalletAddress: Address, hasAccessToETH: boolean) => {
106
-
107
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET);
108
-
85
+ };
86
+ export const _toggleAccessToETH = async (client, address, eSIMWalletAddress, hasAccessToETH) => {
87
+ if (!client.account)
88
+ throw new Error(customErrors.MISSING_SMART_WALLET);
109
89
  // UserOp
110
90
  return client.sendUserOperation({
111
91
  account: client.account,
112
- uo:{
92
+ uo: {
113
93
  target: address,
114
94
  data: encodeFunctionData({
115
95
  abi: DeviceWallet,
@@ -118,16 +98,14 @@ export const _toggleAccessToETH = async (client: SmartAccountClient, address: Ad
118
98
  })
119
99
  }
120
100
  });
121
- }
122
-
123
- export const _addESIMWallet = async (client: SmartAccountClient, address: Address, eSIMWalletAddress: Address, hasAccessToETH: boolean) => {
124
-
125
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET);
126
-
101
+ };
102
+ export const _addESIMWallet = async (client, address, eSIMWalletAddress, hasAccessToETH) => {
103
+ if (!client.account)
104
+ throw new Error(customErrors.MISSING_SMART_WALLET);
127
105
  // UserOp
128
106
  return client.sendUserOperation({
129
107
  account: client.account,
130
- uo:{
108
+ uo: {
131
109
  target: address,
132
110
  data: encodeFunctionData({
133
111
  abi: DeviceWallet,
@@ -136,16 +114,14 @@ export const _addESIMWallet = async (client: SmartAccountClient, address: Addres
136
114
  })
137
115
  }
138
116
  });
139
- }
140
-
141
- export const _removeESIMWallet = async (client: SmartAccountClient, address: Address, eSIMWalletAddress: Address, hasAccessToETH: boolean) => {
142
-
143
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET);
144
-
117
+ };
118
+ export const _removeESIMWallet = async (client, address, eSIMWalletAddress, hasAccessToETH) => {
119
+ if (!client.account)
120
+ throw new Error(customErrors.MISSING_SMART_WALLET);
145
121
  // UserOp
146
122
  return client.sendUserOperation({
147
123
  account: client.account,
148
- uo:{
124
+ uo: {
149
125
  target: address,
150
126
  data: encodeFunctionData({
151
127
  abi: DeviceWallet,
@@ -154,19 +130,15 @@ export const _removeESIMWallet = async (client: SmartAccountClient, address: Add
154
130
  })
155
131
  }
156
132
  });
157
- }
158
-
159
- export const _getOwner = async (client: WalletClient, address: Address) => {
160
-
133
+ };
134
+ export const _getOwner = async (client, address) => {
161
135
  const contract = getContract({
162
136
  abi: DeviceWallet,
163
137
  address: address,
164
138
  client
165
- })
166
-
139
+ });
167
140
  const x = await contract.read.owner([0]);
168
141
  const y = await contract.read.owner([1]);
169
-
170
- const owner = [x,y];
171
- return owner as P256Key;
172
- }
142
+ const owner = [x, y];
143
+ return owner;
144
+ };
@@ -1,22 +1,12 @@
1
- import { encodeFunctionData, WalletClient } from "viem";
2
- import { SmartAccountClient } from "@aa-sdk/core";
3
- import { _extractChainID, _getChainSpecificConstants, customErrors } from "./constants.js";
1
+ import { encodeFunctionData } from "viem";
2
+ import { _getChainSpecificConstants, customErrors } from "./constants.js";
4
3
  import { DeviceWalletFactory } from "../abis/index.js";
5
-
6
- export const _createAccountWithEOA = async (
7
- client: WalletClient,
8
- deviceUniqueIdentifier: string,
9
- deviceWalletOwnerKey: string,
10
- salt: bigint,
11
- depositAmount: bigint
12
- ) => {
13
-
4
+ export const _createAccountWithEOA = async (client, deviceUniqueIdentifier, deviceWalletOwnerKey, salt, depositAmount) => {
14
5
  const chainID = await client.getChainId();
15
- const rpcURL = client.transport.url;
16
- const values = _getChainSpecificConstants(chainID, rpcURL);
17
-
18
- if (!client.account) throw new Error(customErrors.MISSING_EOA_WALLET);
19
-
6
+ const rpcURL = client.transport.url;
7
+ const values = _getChainSpecificConstants(chainID, rpcURL);
8
+ if (!client.account)
9
+ throw new Error(customErrors.MISSING_EOA_WALLET);
20
10
  return client.writeContract({
21
11
  address: values.factoryAddresses.DEVICE_WALLET_FACTORY,
22
12
  chain: values.chain,
@@ -25,25 +15,17 @@ export const _createAccountWithEOA = async (
25
15
  functionName: 'createAccount',
26
16
  args: [deviceUniqueIdentifier, deviceWalletOwnerKey, salt, depositAmount]
27
17
  });
28
- }
29
-
30
- export const _getAddress = async (
31
- client: SmartAccountClient,
32
- deviceUniqueIdentifier: string,
33
- deviceWalletOwnerKey: string,
34
- salt: bigint,
35
- ) => {
36
-
18
+ };
19
+ export const _getAddress = async (client, deviceUniqueIdentifier, deviceWalletOwnerKey, salt) => {
37
20
  const chainID = await client.getChainId();
38
- const rpcURL = client.transport.url;
39
- const values = _getChainSpecificConstants(chainID, rpcURL);
40
-
41
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
42
-
21
+ const rpcURL = client.transport.url;
22
+ const values = _getChainSpecificConstants(chainID, rpcURL);
23
+ if (!client.account)
24
+ throw new Error(customErrors.MISSING_SMART_WALLET);
43
25
  // UserOp
44
26
  return client.sendUserOperation({
45
27
  account: client.account,
46
- uo:{
28
+ uo: {
47
29
  target: values.factoryAddresses.DEVICE_WALLET_FACTORY,
48
30
  data: encodeFunctionData({
49
31
  abi: DeviceWalletFactory,
@@ -52,20 +34,17 @@ export const _getAddress = async (
52
34
  })
53
35
  }
54
36
  });
55
- }
56
-
57
- export const _getCurrentDeviceWalletImplementation = async (client: SmartAccountClient) => {
58
-
37
+ };
38
+ export const _getCurrentDeviceWalletImplementation = async (client) => {
59
39
  const chainID = await client.getChainId();
60
- const rpcURL = client.transport.url;
61
- const values = _getChainSpecificConstants(chainID, rpcURL);
62
-
63
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
64
-
40
+ const rpcURL = client.transport.url;
41
+ const values = _getChainSpecificConstants(chainID, rpcURL);
42
+ if (!client.account)
43
+ throw new Error(customErrors.MISSING_SMART_WALLET);
65
44
  // UserOp
66
45
  return client.sendUserOperation({
67
46
  account: client.account,
68
- uo:{
47
+ uo: {
69
48
  target: values.factoryAddresses.DEVICE_WALLET_FACTORY,
70
49
  data: encodeFunctionData({
71
50
  abi: DeviceWalletFactory,
@@ -74,4 +53,4 @@ export const _getCurrentDeviceWalletImplementation = async (client: SmartAccount
74
53
  })
75
54
  }
76
55
  });
77
- }
56
+ };
@@ -1,18 +1,13 @@
1
- import { Address, encodeFunctionData, WalletClient } from "viem"
2
- import { DataBundleDetails } from "../types.js";
3
- import { SmartAccountClient } from "@aa-sdk/core";
1
+ import { encodeFunctionData } from "viem";
4
2
  import { customErrors } from "./constants.js";
5
3
  import { ESIMWallet } from "../abis/index.js";
6
-
7
-
8
- export const _setESIMUniqueIdentifier = async (client: SmartAccountClient, address: Address, eSIMUniqueIdentifier: string) => {
9
-
10
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
11
-
4
+ export const _setESIMUniqueIdentifier = async (client, address, eSIMUniqueIdentifier) => {
5
+ if (!client.account)
6
+ throw new Error(customErrors.MISSING_SMART_WALLET);
12
7
  // UserOp
13
8
  return client.sendUserOperation({
14
9
  account: client.account,
15
- uo:{
10
+ uo: {
16
11
  target: address,
17
12
  data: encodeFunctionData({
18
13
  abi: ESIMWallet,
@@ -21,16 +16,14 @@ export const _setESIMUniqueIdentifier = async (client: SmartAccountClient, addre
21
16
  })
22
17
  }
23
18
  });
24
- }
25
-
26
- export const _buyDataBundle = async (client: SmartAccountClient, address: Address, dataBundleDetails: DataBundleDetails) => {
27
-
28
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
29
-
19
+ };
20
+ export const _buyDataBundle = async (client, address, dataBundleDetails) => {
21
+ if (!client.account)
22
+ throw new Error(customErrors.MISSING_SMART_WALLET);
30
23
  // UserOp
31
24
  return client.sendUserOperation({
32
25
  account: client.account,
33
- uo:{
26
+ uo: {
34
27
  target: address,
35
28
  data: encodeFunctionData({
36
29
  abi: ESIMWallet,
@@ -39,16 +32,14 @@ export const _buyDataBundle = async (client: SmartAccountClient, address: Addres
39
32
  })
40
33
  }
41
34
  });
42
- }
43
-
44
- export const _populateHistory = async (client: SmartAccountClient, address: Address, dataBundleDetails: Array<DataBundleDetails>) => {
45
-
46
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
47
-
35
+ };
36
+ export const _populateHistory = async (client, address, dataBundleDetails) => {
37
+ if (!client.account)
38
+ throw new Error(customErrors.MISSING_SMART_WALLET);
48
39
  // UserOp
49
40
  return client.sendUserOperation({
50
41
  account: client.account,
51
- uo:{
42
+ uo: {
52
43
  target: address,
53
44
  data: encodeFunctionData({
54
45
  abi: ESIMWallet,
@@ -57,16 +48,14 @@ export const _populateHistory = async (client: SmartAccountClient, address: Addr
57
48
  })
58
49
  }
59
50
  });
60
- }
61
-
62
- export const _owner = async (client: SmartAccountClient, address: Address) => {
63
-
64
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
65
-
51
+ };
52
+ export const _owner = async (client, address) => {
53
+ if (!client.account)
54
+ throw new Error(customErrors.MISSING_SMART_WALLET);
66
55
  // UserOp
67
56
  return client.sendUserOperation({
68
57
  account: client.account,
69
- uo:{
58
+ uo: {
70
59
  target: address,
71
60
  data: encodeFunctionData({
72
61
  abi: ESIMWallet,
@@ -75,16 +64,14 @@ export const _owner = async (client: SmartAccountClient, address: Address) => {
75
64
  })
76
65
  }
77
66
  });
78
- }
79
-
80
- export const _requestTransferOwnership = async (client: SmartAccountClient, address: Address, newOwner: Address) => {
81
-
82
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
83
-
67
+ };
68
+ export const _requestTransferOwnership = async (client, address, newOwner) => {
69
+ if (!client.account)
70
+ throw new Error(customErrors.MISSING_SMART_WALLET);
84
71
  // UserOp
85
72
  return client.sendUserOperation({
86
73
  account: client.account,
87
- uo:{
74
+ uo: {
88
75
  target: address,
89
76
  data: encodeFunctionData({
90
77
  abi: ESIMWallet,
@@ -93,15 +80,14 @@ export const _requestTransferOwnership = async (client: SmartAccountClient, addr
93
80
  })
94
81
  }
95
82
  });
96
- }
97
-
98
- export const _acceptOwnershipTransfer = async (client: SmartAccountClient, address: Address) => {
99
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
100
-
83
+ };
84
+ export const _acceptOwnershipTransfer = async (client, address) => {
85
+ if (!client.account)
86
+ throw new Error(customErrors.MISSING_SMART_WALLET);
101
87
  // UserOp
102
88
  return client.sendUserOperation({
103
89
  account: client.account,
104
- uo:{
90
+ uo: {
105
91
  target: address,
106
92
  data: encodeFunctionData({
107
93
  abi: ESIMWallet,
@@ -110,16 +96,14 @@ export const _acceptOwnershipTransfer = async (client: SmartAccountClient, addre
110
96
  })
111
97
  }
112
98
  });
113
- }
114
-
115
- export const _sendETHToDeviceWallet = async (client: SmartAccountClient, address: Address, amount: bigint) => {
116
-
117
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
118
-
99
+ };
100
+ export const _sendETHToDeviceWallet = async (client, address, amount) => {
101
+ if (!client.account)
102
+ throw new Error(customErrors.MISSING_SMART_WALLET);
119
103
  // UserOp
120
104
  return client.sendUserOperation({
121
105
  account: client.account,
122
- uo:{
106
+ uo: {
123
107
  target: address,
124
108
  data: encodeFunctionData({
125
109
  abi: ESIMWallet,
@@ -128,16 +112,14 @@ export const _sendETHToDeviceWallet = async (client: SmartAccountClient, address
128
112
  })
129
113
  }
130
114
  });
131
- }
132
-
133
- export const _transferOwnership = async (client: SmartAccountClient, address: Address, amount: bigint) => {
134
-
135
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
136
-
115
+ };
116
+ export const _transferOwnership = async (client, address, amount) => {
117
+ if (!client.account)
118
+ throw new Error(customErrors.MISSING_SMART_WALLET);
137
119
  // UserOp
138
120
  return client.sendUserOperation({
139
121
  account: client.account,
140
- uo:{
122
+ uo: {
141
123
  target: address,
142
124
  data: encodeFunctionData({
143
125
  abi: ESIMWallet,
@@ -146,4 +128,4 @@ export const _transferOwnership = async (client: SmartAccountClient, address: Ad
146
128
  })
147
129
  }
148
130
  });
149
- }
131
+ };
@@ -1,20 +1,16 @@
1
- import { Address, encodeFunctionData, WalletClient } from "viem"
1
+ import { encodeFunctionData } from "viem";
2
2
  import { _getChainSpecificConstants, customErrors } from "./constants.js";
3
- import { SmartAccountClient } from "@aa-sdk/core";
4
3
  import { ESIMWalletFactory } from "../abis/index.js";
5
-
6
- export const _addRegistryAddress = async (client: SmartAccountClient, registryContractAddress: Address) => {
7
-
4
+ export const _addRegistryAddress = async (client, registryContractAddress) => {
8
5
  const chainID = await client.getChainId();
9
- const rpcURL = client.transport.url;
10
- const values = _getChainSpecificConstants(chainID, rpcURL);
11
-
12
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
13
-
6
+ const rpcURL = client.transport.url;
7
+ const values = _getChainSpecificConstants(chainID, rpcURL);
8
+ if (!client.account)
9
+ throw new Error(customErrors.MISSING_SMART_WALLET);
14
10
  // UserOp
15
11
  return client.sendUserOperation({
16
12
  account: client.account,
17
- uo:{
13
+ uo: {
18
14
  target: values.factoryAddresses.ESIM_WALLET_FACTORY,
19
15
  data: encodeFunctionData({
20
16
  abi: ESIMWalletFactory,
@@ -23,16 +19,13 @@ export const _addRegistryAddress = async (client: SmartAccountClient, registryCo
23
19
  })
24
20
  }
25
21
  });
26
- }
27
-
28
- export const _deployESIMWalletWithEOA = async (client: WalletClient, deviceWalletAddress: Address, salt: bigint) => {
29
-
22
+ };
23
+ export const _deployESIMWalletWithEOA = async (client, deviceWalletAddress, salt) => {
30
24
  const chainID = await client.getChainId();
31
- const rpcURL = client.transport.url;
32
- const values = _getChainSpecificConstants(chainID, rpcURL);
33
-
34
- if (!client.account) throw new Error(customErrors.MISSING_EOA_WALLET);
35
-
25
+ const rpcURL = client.transport.url;
26
+ const values = _getChainSpecificConstants(chainID, rpcURL);
27
+ if (!client.account)
28
+ throw new Error(customErrors.MISSING_EOA_WALLET);
36
29
  return client.writeContract({
37
30
  address: values.factoryAddresses.ESIM_WALLET_FACTORY,
38
31
  chain: values.chain,
@@ -41,20 +34,17 @@ export const _deployESIMWalletWithEOA = async (client: WalletClient, deviceWalle
41
34
  functionName: 'deployESIMWallet',
42
35
  args: [deviceWalletAddress, salt]
43
36
  });
44
- }
45
-
46
- export const _deployESIMWalletWithUserOp = async (client: SmartAccountClient, deviceWalletAddress: Address, salt: bigint) => {
47
-
37
+ };
38
+ export const _deployESIMWalletWithUserOp = async (client, deviceWalletAddress, salt) => {
48
39
  const chainID = await client.getChainId();
49
- const rpcURL = client.transport.url;
50
- const values = _getChainSpecificConstants(chainID, rpcURL);
51
-
52
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
53
-
40
+ const rpcURL = client.transport.url;
41
+ const values = _getChainSpecificConstants(chainID, rpcURL);
42
+ if (!client.account)
43
+ throw new Error(customErrors.MISSING_SMART_WALLET);
54
44
  // UserOp
55
45
  return client.sendUserOperation({
56
46
  account: client.account,
57
- uo:{
47
+ uo: {
58
48
  target: values.factoryAddresses.ESIM_WALLET_FACTORY,
59
49
  data: encodeFunctionData({
60
50
  abi: ESIMWalletFactory,
@@ -63,20 +53,17 @@ export const _deployESIMWalletWithUserOp = async (client: SmartAccountClient, de
63
53
  })
64
54
  }
65
55
  });
66
- }
67
-
68
- export const _getCurrentESIMWalletImplementation = async (client: SmartAccountClient) => {
69
-
56
+ };
57
+ export const _getCurrentESIMWalletImplementation = async (client) => {
70
58
  const chainID = await client.getChainId();
71
- const rpcURL = client.transport.url;
72
- const values = _getChainSpecificConstants(chainID, rpcURL);
73
-
74
- if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
75
-
59
+ const rpcURL = client.transport.url;
60
+ const values = _getChainSpecificConstants(chainID, rpcURL);
61
+ if (!client.account)
62
+ throw new Error(customErrors.MISSING_SMART_WALLET);
76
63
  // UserOp
77
64
  return client.sendUserOperation({
78
65
  account: client.account,
79
- uo:{
66
+ uo: {
80
67
  target: values.factoryAddresses.ESIM_WALLET_FACTORY,
81
68
  data: encodeFunctionData({
82
69
  abi: ESIMWalletFactory,
@@ -85,4 +72,4 @@ export const _getCurrentESIMWalletImplementation = async (client: SmartAccountCl
85
72
  })
86
73
  }
87
74
  });
88
- }
75
+ };