kokio-sdk 0.1.2 → 0.1.3

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 +40 -0
  12. package/dist/esm/interface/P256VerifierClass.js +10 -0
  13. package/dist/esm/interface/constantsClass.js +15 -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 +299 -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 +27 -0
  43. package/dist/types/interface/P256VerifierClass.d.ts +7 -0
  44. package/dist/types/interface/constantsClass.d.ts +7 -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 +20 -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
package/src/abis/index.ts DELETED
@@ -1,21 +0,0 @@
1
- import DeviceWallet from './DeviceWallet.json' with { type: 'json' };
2
- import DeviceWalletFactory from './DeviceWalletFactory.json' with { type: 'json' };
3
- import ESIMWallet from './ESIMWallet.json' with { type: 'json' };
4
- import ESIMWalletFactory from './ESIMWalletFactory.json' with { type: 'json' };
5
- import LazyWalletRegistry from './LazyWalletRegistry.json' with { type: 'json' };
6
- import P256Verifier from './P256Verifier.json' with { type: 'json' };
7
- import Registry from './Registry.json' with { type: 'json' };
8
- import RegistryHelper from './RegistryHelper.json' with { type: 'json' };
9
- import BeaconProxy from './BeaconProxy.json' with { type: 'json' }
10
-
11
- export {
12
- DeviceWallet,
13
- DeviceWalletFactory,
14
- ESIMWallet,
15
- ESIMWalletFactory,
16
- LazyWalletRegistry,
17
- P256Verifier,
18
- Registry,
19
- RegistryHelper,
20
- BeaconProxy
21
- }
package/src/config.ts DELETED
@@ -1,58 +0,0 @@
1
- import { Address, WalletClient } from "viem";
2
- import { ConstantsSubPackage } from "./interface/constantsClass.js";
3
- import { SmartAccountSubPackage } from "./interface/smartAccountClass.js";
4
- import { DeviceWalletFactorySubPackage } from "./interface/deviceWalletFactoryClass.js";
5
- import { P256VerifierSubPackage } from "./interface/P256VerifierClass.js";
6
- import { LazyWalletRegistrySubPackage } from "./interface/lazyWalletRegistryClass.js";
7
- import { DeviceWalletSubPackage } from "./interface/deviceWalletClass.js";
8
- import { ESIMWalletSubPackage } from "./interface/eSIMWalletClass.js";
9
- import { ESIMWalletFactorySubPackage } from "./interface/eSIMWalletFactoryClass.js";
10
- import { SmartAccountClient } from "@aa-sdk/core";
11
-
12
- export class Kokio {
13
- viemWalletClient: WalletClient;
14
- credentialId: string;
15
- rpId: string;
16
- organizationId: string;
17
- pimlicoAPIKey: string;
18
- gasPolicyId: string;
19
-
20
- constants: ConstantsSubPackage;
21
-
22
- smartAccount: SmartAccountSubPackage;
23
- deviceWalletFactory?: DeviceWalletFactorySubPackage;
24
- eSIMWalletFactory?: ESIMWalletFactorySubPackage;
25
- lazyWalletRegistry?: LazyWalletRegistrySubPackage;
26
- deviceWallet?: DeviceWalletSubPackage;
27
- eSIMWallet?: ESIMWalletSubPackage;
28
- P256Verifier?: P256VerifierSubPackage;
29
-
30
- constructor(
31
- viemWalletClient: WalletClient,
32
- credentialId: string,
33
- rpId: string,
34
- organizationId: string,
35
- pimlicoAPIKey: string,
36
- gasPolicyId: string,
37
- smartAccountClient?: SmartAccountClient,
38
- deviceWalletAddress?: Address,
39
- eSIMWalletAddress?: Address
40
- ) {
41
- this.viemWalletClient = viemWalletClient;
42
- this.credentialId = credentialId;
43
- this.rpId = rpId;
44
- this.organizationId = organizationId;
45
- this.pimlicoAPIKey = pimlicoAPIKey;
46
- this.gasPolicyId = gasPolicyId;
47
-
48
- this.constants = new ConstantsSubPackage(this.viemWalletClient, this.pimlicoAPIKey);
49
-
50
- this.smartAccount = new SmartAccountSubPackage(this.viemWalletClient, this.credentialId, this.rpId, this.organizationId, this.pimlicoAPIKey, this.gasPolicyId);
51
- this.deviceWalletFactory = smartAccountClient? new DeviceWalletFactorySubPackage(viemWalletClient, smartAccountClient): undefined;
52
- this.eSIMWalletFactory = smartAccountClient? new ESIMWalletFactorySubPackage(viemWalletClient, smartAccountClient): undefined;
53
- this.lazyWalletRegistry = smartAccountClient? new LazyWalletRegistrySubPackage(smartAccountClient): undefined;
54
- this.P256Verifier = smartAccountClient? new P256VerifierSubPackage(smartAccountClient): undefined;
55
- this.deviceWallet = deviceWalletAddress && smartAccountClient? new DeviceWalletSubPackage(viemWalletClient, smartAccountClient, deviceWalletAddress): undefined;
56
- this.eSIMWallet = eSIMWalletAddress && smartAccountClient? new ESIMWalletSubPackage(smartAccountClient, eSIMWalletAddress): undefined;
57
- }
58
- }
@@ -1,19 +0,0 @@
1
- import { Address, WalletClient } from "viem";
2
- import {
3
- _verifySignature
4
- } from "../logic/P256Verifier.js"
5
- import { WebAuthnSignature } from "../types";
6
- import { SmartAccountClient } from "@aa-sdk/core";
7
-
8
- export class P256VerifierSubPackage {
9
-
10
- client;
11
-
12
- constructor(client: SmartAccountClient) {
13
- this.client = client;
14
- }
15
-
16
- verifySignature (message: string, requireMessageVerification: boolean, webAuthnSignature: WebAuthnSignature, x: bigint, y: bigint) {
17
- return _verifySignature(this.client, message, requireMessageVerification, webAuthnSignature, x, y);
18
- }
19
- }
@@ -1,36 +0,0 @@
1
- import { WalletClient } from "viem";
2
- import {
3
- _extractChainID,
4
- _getChainSpecificConstants,
5
- mainnetFactoryAddresses,
6
- sepoliaFactoryAddresses,
7
- optimismMainnetFactoryAddresses,
8
- optimismSepoliaFactoryAddresses,
9
- arbitrumOneFactoryAddresses,
10
- arbitrumSepoliaFactoryAddresses,
11
- customErrors
12
- } from "../logic/constants.js"
13
-
14
- export class ConstantsSubPackage {
15
- factoryAddresses!:
16
- typeof sepoliaFactoryAddresses |
17
- typeof mainnetFactoryAddresses |
18
- typeof optimismMainnetFactoryAddresses |
19
- typeof optimismSepoliaFactoryAddresses |
20
- typeof arbitrumOneFactoryAddresses |
21
- typeof arbitrumSepoliaFactoryAddresses;
22
- customErrors!: typeof customErrors;
23
-
24
- constructor(client: WalletClient, pimlicoAPIKey: string) {
25
- (async () => {
26
- const chainID = await _extractChainID(client);
27
- const rpcURL = client.transport.url;
28
- const values = _getChainSpecificConstants(chainID, rpcURL, pimlicoAPIKey);
29
-
30
- this.factoryAddresses = values?.factoryAddresses;
31
- this.customErrors = values?.customErrors;
32
-
33
- return this;
34
- })();
35
- }
36
- }
@@ -1,35 +0,0 @@
1
- import { Address, WalletClient } from "viem";
2
- import {
3
- _createAccountWithEOA,
4
- _getAddress,
5
- _getCurrentDeviceWalletImplementation
6
- } from "../logic/deviceWalletFactory.js"
7
- import { SmartAccountClient } from "@aa-sdk/core";
8
-
9
- export class DeviceWalletFactorySubPackage {
10
-
11
- smartAccountClient;
12
- walletClient;
13
-
14
- constructor(walletClient: WalletClient, smartAccountClient: SmartAccountClient) {
15
- this.smartAccountClient = smartAccountClient;
16
- this.walletClient = walletClient
17
- }
18
-
19
- createAccountWithEOA (
20
- deviceUniqueIdentifier: string,
21
- deviceWalletOwnerKey: string,
22
- salt: bigint,
23
- depositAmount: bigint
24
- ) {
25
- return _createAccountWithEOA(this.walletClient, deviceUniqueIdentifier, deviceWalletOwnerKey, salt, depositAmount);
26
- }
27
-
28
- getAddress (deviceUniqueIdentifier: string, deviceWalletOwnerKey: string, salt: bigint) {
29
- return _getAddress(this.smartAccountClient, deviceUniqueIdentifier, deviceWalletOwnerKey, salt);
30
- }
31
-
32
- getCurrentDeviceWalletImplementation () {
33
- return _getCurrentDeviceWalletImplementation(this.smartAccountClient);
34
- }
35
- }
@@ -1,55 +0,0 @@
1
- import { Address, WalletClient } from "viem";
2
- import {
3
- _acceptOwnershipTransfer,
4
- _buyDataBundle,
5
- _owner,
6
- _populateHistory,
7
- _requestTransferOwnership,
8
- _sendETHToDeviceWallet,
9
- _setESIMUniqueIdentifier,
10
- _transferOwnership
11
- } from "../logic/eSIMWallet.js"
12
- import { DataBundleDetails } from "../types";
13
- import { SmartAccountClient } from "@aa-sdk/core";
14
-
15
- export class ESIMWalletSubPackage {
16
-
17
- client;
18
- address;
19
-
20
- constructor(client: SmartAccountClient, address: Address) {
21
- this.client = client;
22
- this.address = address;
23
- }
24
-
25
- acceptOwnershipTransfer () {
26
- return _acceptOwnershipTransfer(this.client, this.address);
27
- }
28
-
29
- buyDataBundle (dataBundleDetails: DataBundleDetails) {
30
- return _buyDataBundle(this.client, this.address, dataBundleDetails);
31
- }
32
-
33
- owner () {
34
- return _owner(this.client, this.address);
35
- }
36
-
37
- populateHistory (dataBundleDetails: Array<DataBundleDetails>) {
38
- return _populateHistory(this.client, this.address, dataBundleDetails);
39
- }
40
-
41
- requestTransferOwnership (newOwner: Address) {
42
- return _requestTransferOwnership(this.client, this.address, newOwner);
43
- }
44
-
45
- sendETHToDeviceWallet (amount: bigint) {
46
- return _sendETHToDeviceWallet(this.client, this.address, amount);
47
- }
48
- _setESIMUniqueIdentifier (eSIMUniqueIdentifier: string) {
49
- return _setESIMUniqueIdentifier(this.client, this.address, eSIMUniqueIdentifier);
50
- }
51
-
52
- _transferOwnership (amount: bigint) {
53
- return _transferOwnership(this.client, this.address, amount);
54
- }
55
- }
@@ -1,36 +0,0 @@
1
- import { Address, WalletClient } from "viem";
2
- import {
3
- _addRegistryAddress,
4
- _deployESIMWalletWithEOA,
5
- _deployESIMWalletWithUserOp,
6
- _getCurrentESIMWalletImplementation
7
- } from "../logic/eSIMWalletFactory.js"
8
- import { SmartAccountClient } from "@aa-sdk/core";
9
-
10
- export class ESIMWalletFactorySubPackage {
11
-
12
- smartAccountClient;
13
- walletClient;
14
-
15
- constructor(walletClient: WalletClient, smartAccountClient: SmartAccountClient) {
16
- this.smartAccountClient = smartAccountClient;
17
- this.walletClient = walletClient
18
- }
19
-
20
- deployESIMWalletWithEOA (deviceWalletAddress: Address, salt: bigint) {
21
- return _deployESIMWalletWithEOA (this.walletClient, deviceWalletAddress, salt);
22
- }
23
-
24
-
25
- deployESIMWalletWithUserOp (deviceWalletAddress: Address, salt: bigint) {
26
- return _deployESIMWalletWithUserOp (this.smartAccountClient, deviceWalletAddress, salt);
27
- }
28
-
29
- addRegistryAddress (registryContractAddress: Address) {
30
- return _addRegistryAddress(this.smartAccountClient, registryContractAddress);
31
- }
32
-
33
- _getCurrentESIMWalletImplementation () {
34
- return _getCurrentESIMWalletImplementation(this.smartAccountClient);
35
- }
36
- }
@@ -1,34 +0,0 @@
1
- import { Address, Hex, WalletClient } from "viem";
2
- import {
3
- _batchPopulateHistory,
4
- _deployLazyWalletAndSetESIMIdentifier,
5
- _isLazyWalletDeployed,
6
- _switchESIMIdentifierToNewDeviceIdentifier
7
- } from "../logic/lazyWalletRegistry.js"
8
- import { DataBundleDetails } from "../types";
9
- import { SmartAccountClient } from "@aa-sdk/core";
10
-
11
- export class LazyWalletRegistrySubPackage {
12
-
13
- client;
14
-
15
- constructor(client: SmartAccountClient) {
16
- this.client = client;
17
- }
18
-
19
- _batchPopulateHistory (deviceUniqueIdentifiers: Array<string>, eSIMUniqueIdentifiers: Array<Array<string>>, dataBundleDetails: Array<Array<DataBundleDetails>>) {
20
- return _batchPopulateHistory(this.client, deviceUniqueIdentifiers, eSIMUniqueIdentifiers, dataBundleDetails);
21
- }
22
-
23
- _deployLazyWalletAndSetESIMIdentifier (deviceOwnerPublicKey: Hex[2], deviceUniqueIdentifier: string, salt: bigint, depositAmount: bigint) {
24
- return _deployLazyWalletAndSetESIMIdentifier(this.client, deviceOwnerPublicKey, deviceUniqueIdentifier, salt, depositAmount);
25
- }
26
-
27
- _isLazyWalletDeployed (deviceUniqueIdentifier: string) {
28
- return _isLazyWalletDeployed(this.client, deviceUniqueIdentifier);
29
- }
30
-
31
- _switchESIMIdentifierToNewDeviceIdentifier (eSIMIdentifier: string, oldDeviceIdentifier: string, newDeviceIdentifier: string) {
32
- return _switchESIMIdentifierToNewDeviceIdentifier(this.client, eSIMIdentifier, oldDeviceIdentifier, newDeviceIdentifier);
33
- }
34
- }
@@ -1,21 +0,0 @@
1
- import { WalletClient } from "viem";
2
- import { _add0x, _remove0x } from "../logic/utils.js";
3
- import { AccountOp, SmartAccountClient } from "@aa-sdk/core";
4
-
5
- export class UtilsSubPackage {
6
-
7
- client;
8
-
9
- constructor(client: WalletClient) {
10
- this.client = client;
11
- }
12
-
13
- add0x(data: string) {
14
- _add0x(data);
15
- }
16
-
17
- remove0x(data: string) {
18
- _remove0x(data);
19
- }
20
-
21
- }