kokio-sdk 3.3.0 → 3.5.0
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/README.md +8 -4
- package/dist/esm/abis/DeviceWallet.js +29 -0
- package/dist/esm/abis/ESIMWallet.js +55 -0
- package/dist/esm/abis/PaymentAdapter.js +53 -0
- package/dist/esm/abis/ProtocolAdmin.js +48 -0
- package/dist/esm/abis/Registry.js +55 -0
- package/dist/esm/abis/RegistryHelper.js +13 -0
- package/dist/esm/admin/config-admin.js +3 -1
- package/dist/esm/admin/interface/eSIMWalletClass.js +4 -1
- package/dist/esm/admin/interface/paymentAdapterClass.js +4 -1
- package/dist/esm/admin/interface/protocolAdminClass.js +7 -1
- package/dist/esm/admin/interface/registryClass.js +6 -3
- package/dist/esm/admin/interface/utilsClass.js +19 -3
- package/dist/esm/interface/deviceWalletClass.js +6 -3
- package/dist/esm/interface/eSIMWalletClass.js +7 -1
- package/dist/esm/interface/registryClass.js +4 -1
- package/dist/esm/logic/admin/eSIMWallet.eoa.js +9 -1
- package/dist/esm/logic/admin/paymentAdapter.eoa.js +16 -0
- package/dist/esm/logic/admin/protocolAdmin.eoa.js +34 -0
- package/dist/esm/logic/admin/reads/eSIMWallet.reads.js +12 -0
- package/dist/esm/logic/admin/reads/registry.reads.js +12 -0
- package/dist/esm/logic/admin/registry.eoa.js +79 -5
- package/dist/esm/logic/admin/utils/paymentReference.js +58 -0
- package/dist/esm/logic/constants.js +11 -14
- package/dist/esm/logic/deviceWallet.js +19 -6
- package/dist/esm/logic/eSIMWallet.js +36 -0
- package/dist/esm/logic/errors.js +38 -0
- package/dist/esm/logic/registry.js +12 -0
- package/dist/types/abis/DeviceWallet.d.ts +22 -0
- package/dist/types/abis/ESIMWallet.d.ts +42 -0
- package/dist/types/abis/PaymentAdapter.d.ts +42 -0
- package/dist/types/abis/ProtocolAdmin.d.ts +37 -0
- package/dist/types/abis/Registry.d.ts +42 -0
- package/dist/types/abis/RegistryHelper.d.ts +10 -0
- package/dist/types/admin/config-admin.d.ts +2 -1
- package/dist/types/admin/interface/eSIMWalletClass.d.ts +1 -0
- package/dist/types/admin/interface/paymentAdapterClass.d.ts +1 -0
- package/dist/types/admin/interface/protocolAdminClass.d.ts +2 -0
- package/dist/types/admin/interface/registryClass.d.ts +14 -1
- package/dist/types/admin/interface/utilsClass.d.ts +19 -4
- package/dist/types/interface/deviceWalletClass.d.ts +2 -1
- package/dist/types/interface/eSIMWalletClass.d.ts +2 -0
- package/dist/types/interface/registryClass.d.ts +1 -0
- package/dist/types/logic/admin/eSIMWallet.eoa.d.ts +3 -0
- package/dist/types/logic/admin/paymentAdapter.eoa.d.ts +6 -0
- package/dist/types/logic/admin/protocolAdmin.eoa.d.ts +14 -0
- package/dist/types/logic/admin/reads/eSIMWallet.reads.d.ts +5 -0
- package/dist/types/logic/admin/reads/registry.reads.d.ts +2 -0
- package/dist/types/logic/admin/registry.eoa.d.ts +23 -2
- package/dist/types/logic/admin/utils/paymentReference.d.ts +26 -0
- package/dist/types/logic/deviceWallet.d.ts +11 -5
- package/dist/types/logic/eSIMWallet.d.ts +14 -0
- package/dist/types/logic/errors.d.ts +27 -0
- package/dist/types/logic/registry.d.ts +2 -0
- package/package.json +1 -1
|
@@ -443,6 +443,16 @@ declare const ProtocolAdmin: readonly [{
|
|
|
443
443
|
readonly internalType: "bytes4";
|
|
444
444
|
}];
|
|
445
445
|
readonly stateMutability: "nonpayable";
|
|
446
|
+
}, {
|
|
447
|
+
readonly type: "function";
|
|
448
|
+
readonly name: "pauseInstantly";
|
|
449
|
+
readonly inputs: readonly [{
|
|
450
|
+
readonly name: "target";
|
|
451
|
+
readonly type: "address";
|
|
452
|
+
readonly internalType: "address";
|
|
453
|
+
}];
|
|
454
|
+
readonly outputs: readonly [];
|
|
455
|
+
readonly stateMutability: "nonpayable";
|
|
446
456
|
}, {
|
|
447
457
|
readonly type: "function";
|
|
448
458
|
readonly name: "renounceRole";
|
|
@@ -740,6 +750,21 @@ declare const ProtocolAdmin: readonly [{
|
|
|
740
750
|
readonly internalType: "address";
|
|
741
751
|
}];
|
|
742
752
|
readonly anonymous: false;
|
|
753
|
+
}, {
|
|
754
|
+
readonly type: "event";
|
|
755
|
+
readonly name: "PauseRaised";
|
|
756
|
+
readonly inputs: readonly [{
|
|
757
|
+
readonly name: "target";
|
|
758
|
+
readonly type: "address";
|
|
759
|
+
readonly indexed: true;
|
|
760
|
+
readonly internalType: "address";
|
|
761
|
+
}, {
|
|
762
|
+
readonly name: "guardian";
|
|
763
|
+
readonly type: "address";
|
|
764
|
+
readonly indexed: true;
|
|
765
|
+
readonly internalType: "address";
|
|
766
|
+
}];
|
|
767
|
+
readonly anonymous: false;
|
|
743
768
|
}, {
|
|
744
769
|
readonly type: "event";
|
|
745
770
|
readonly name: "PauseReleased";
|
|
@@ -855,6 +880,18 @@ declare const ProtocolAdmin: readonly [{
|
|
|
855
880
|
readonly type: "error";
|
|
856
881
|
readonly name: "NoProposers";
|
|
857
882
|
readonly inputs: readonly [];
|
|
883
|
+
}, {
|
|
884
|
+
readonly type: "error";
|
|
885
|
+
readonly name: "NomineeIsTheIncumbent";
|
|
886
|
+
readonly inputs: readonly [{
|
|
887
|
+
readonly name: "target";
|
|
888
|
+
readonly type: "address";
|
|
889
|
+
readonly internalType: "address";
|
|
890
|
+
}, {
|
|
891
|
+
readonly name: "admin";
|
|
892
|
+
readonly type: "address";
|
|
893
|
+
readonly internalType: "address";
|
|
894
|
+
}];
|
|
858
895
|
}, {
|
|
859
896
|
readonly type: "error";
|
|
860
897
|
readonly name: "NotACanceller";
|
|
@@ -114,6 +114,16 @@ declare const Registry: readonly [{
|
|
|
114
114
|
}];
|
|
115
115
|
readonly outputs: readonly [];
|
|
116
116
|
readonly stateMutability: "nonpayable";
|
|
117
|
+
}, {
|
|
118
|
+
readonly type: "function";
|
|
119
|
+
readonly name: "defaultAdminAllowanceUSDCents";
|
|
120
|
+
readonly inputs: readonly [];
|
|
121
|
+
readonly outputs: readonly [{
|
|
122
|
+
readonly name: "";
|
|
123
|
+
readonly type: "uint64";
|
|
124
|
+
readonly internalType: "uint64";
|
|
125
|
+
}];
|
|
126
|
+
readonly stateMutability: "view";
|
|
117
127
|
}, {
|
|
118
128
|
readonly type: "function";
|
|
119
129
|
readonly name: "defaultPriceCapUSDCents";
|
|
@@ -303,6 +313,10 @@ declare const Registry: readonly [{
|
|
|
303
313
|
readonly name: "_defaultPriceCapUSDCents";
|
|
304
314
|
readonly type: "uint64";
|
|
305
315
|
readonly internalType: "uint64";
|
|
316
|
+
}, {
|
|
317
|
+
readonly name: "_defaultAdminAllowanceUSDCents";
|
|
318
|
+
readonly type: "uint64";
|
|
319
|
+
readonly internalType: "uint64";
|
|
306
320
|
}];
|
|
307
321
|
readonly outputs: readonly [];
|
|
308
322
|
readonly stateMutability: "nonpayable";
|
|
@@ -574,6 +588,16 @@ declare const Registry: readonly [{
|
|
|
574
588
|
readonly inputs: readonly [];
|
|
575
589
|
readonly outputs: readonly [];
|
|
576
590
|
readonly stateMutability: "view";
|
|
591
|
+
}, {
|
|
592
|
+
readonly type: "function";
|
|
593
|
+
readonly name: "setDefaultAdminAllowanceUSDCents";
|
|
594
|
+
readonly inputs: readonly [{
|
|
595
|
+
readonly name: "_allowance";
|
|
596
|
+
readonly type: "uint64";
|
|
597
|
+
readonly internalType: "uint64";
|
|
598
|
+
}];
|
|
599
|
+
readonly outputs: readonly [];
|
|
600
|
+
readonly stateMutability: "nonpayable";
|
|
577
601
|
}, {
|
|
578
602
|
readonly type: "function";
|
|
579
603
|
readonly name: "setDefaultPriceCapUSDCents";
|
|
@@ -843,6 +867,16 @@ declare const Registry: readonly [{
|
|
|
843
867
|
readonly internalType: "bytes32";
|
|
844
868
|
}];
|
|
845
869
|
readonly anonymous: false;
|
|
870
|
+
}, {
|
|
871
|
+
readonly type: "event";
|
|
872
|
+
readonly name: "DefaultAdminAllowanceUSDCentsUpdated";
|
|
873
|
+
readonly inputs: readonly [{
|
|
874
|
+
readonly name: "_allowance";
|
|
875
|
+
readonly type: "uint64";
|
|
876
|
+
readonly indexed: false;
|
|
877
|
+
readonly internalType: "uint64";
|
|
878
|
+
}];
|
|
879
|
+
readonly anonymous: false;
|
|
846
880
|
}, {
|
|
847
881
|
readonly type: "event";
|
|
848
882
|
readonly name: "DefaultPriceCapUSDCentsUpdated";
|
|
@@ -1326,6 +1360,14 @@ declare const Registry: readonly [{
|
|
|
1326
1360
|
readonly type: "bytes32";
|
|
1327
1361
|
readonly internalType: "bytes32";
|
|
1328
1362
|
}];
|
|
1363
|
+
}, {
|
|
1364
|
+
readonly type: "error";
|
|
1365
|
+
readonly name: "OwnerKeyNotHeldByWallet";
|
|
1366
|
+
readonly inputs: readonly [{
|
|
1367
|
+
readonly name: "deviceWallet";
|
|
1368
|
+
readonly type: "address";
|
|
1369
|
+
readonly internalType: "address";
|
|
1370
|
+
}];
|
|
1329
1371
|
}, {
|
|
1330
1372
|
readonly type: "error";
|
|
1331
1373
|
readonly name: "OwnershipCannotBeRenounced";
|
|
@@ -378,6 +378,16 @@ declare const RegistryHelper: readonly [{
|
|
|
378
378
|
readonly internalType: "bytes32";
|
|
379
379
|
}];
|
|
380
380
|
readonly anonymous: false;
|
|
381
|
+
}, {
|
|
382
|
+
readonly type: "event";
|
|
383
|
+
readonly name: "DefaultAdminAllowanceUSDCentsUpdated";
|
|
384
|
+
readonly inputs: readonly [{
|
|
385
|
+
readonly name: "_allowance";
|
|
386
|
+
readonly type: "uint64";
|
|
387
|
+
readonly indexed: false;
|
|
388
|
+
readonly internalType: "uint64";
|
|
389
|
+
}];
|
|
390
|
+
readonly anonymous: false;
|
|
381
391
|
}, {
|
|
382
392
|
readonly type: "event";
|
|
383
393
|
readonly name: "DefaultPriceCapUSDCentsUpdated";
|
|
@@ -10,9 +10,10 @@ import { AdminESIMWalletSubPackage } from "./interface/eSIMWalletClass.js";
|
|
|
10
10
|
import { AdminPaymentAdapterSubPackage } from "./interface/paymentAdapterClass.js";
|
|
11
11
|
import { AdminCallsSubPackage } from "./interface/callsClass.js";
|
|
12
12
|
import { AdminUtilsSubPackage } from "./interface/utilsClass.js";
|
|
13
|
-
export { KokioError, NullOrUndefinedValueError, MissingSmartWalletError, MissingEOAWalletError, InvalidClientError, UnsupportedChainError, UnconfiguredChainError, CounterfactualMismatchError, BatchSizeOutOfRangeError, DepositOnResumeError, ESIMWalletNotLazyDeployedError, MissingBatchEventError, StalledBatchError, InvalidAddressError, InvalidSymbolError, TokenNotAcceptedError, NotAProtocolESIMWalletError, UnknownTransactionError, TransactionRevertedError, ReceiptNotCanonicalError, NotAnERC20TokenError, UnmatchedPaymentEventsError, PriceOutOfRangeError, ContractRevertError, decodeContractRevert, } from "../logic/errors.js";
|
|
13
|
+
export { KokioError, NullOrUndefinedValueError, MissingSmartWalletError, MissingEOAWalletError, InvalidClientError, UnsupportedChainError, UnconfiguredChainError, CounterfactualMismatchError, BatchSizeOutOfRangeError, DepositOnResumeError, ESIMWalletNotLazyDeployedError, MissingBatchEventError, StalledBatchError, InvalidAddressError, InvalidSymbolError, TokenNotAcceptedError, NotAProtocolESIMWalletError, UnknownTransactionError, TransactionRevertedError, ReceiptNotCanonicalError, NotAnERC20TokenError, UnmatchedPaymentEventsError, PriceOutOfRangeError, AdminAllowanceExceededError, InvalidPaymentReferenceError, CouponSplitOutOfRangeError, ContractRevertError, decodeContractRevert, } from "../logic/errors.js";
|
|
14
14
|
export type { DecodedRevert } from "../logic/errors.js";
|
|
15
15
|
export { OperationState } from "../logic/admin/reads/protocolAdmin.reads.js";
|
|
16
|
+
export { PaymentReferenceKind } from "../logic/admin/utils/paymentReference.js";
|
|
16
17
|
/**
|
|
17
18
|
* EOA-only entry point for the NodeJS backend.
|
|
18
19
|
*
|
|
@@ -15,6 +15,7 @@ export declare class AdminESIMWalletSubPackage {
|
|
|
15
15
|
newRequestedOwner(): Promise<`0x${string}`>;
|
|
16
16
|
owner(): Promise<`0x${string}`>;
|
|
17
17
|
priceCapUSDCents(): Promise<bigint>;
|
|
18
|
+
adminAllowanceUSDCents(): Promise<bigint>;
|
|
18
19
|
deviceWallet(): Promise<`0x${string}`>;
|
|
19
20
|
transactionHistory(index: bigint): Promise<DataBundleDetails>;
|
|
20
21
|
}
|
|
@@ -14,6 +14,7 @@ export declare class AdminPaymentAdapterSubPackage {
|
|
|
14
14
|
updateAsset(symbol: Hex, asset: Asset): Promise<`0x${string}`>;
|
|
15
15
|
acceptOwnership(): Promise<`0x${string}`>;
|
|
16
16
|
registerAssetCall(symbol: Hex, asset: Asset): Promise<import("../../types.js").OwnerCall>;
|
|
17
|
+
recoverTokensCall(token: Address, to: Address, amount: bigint): Promise<import("../../types.js").OwnerCall>;
|
|
17
18
|
updateAssetCall(symbol: Hex, asset: Asset): Promise<import("../../types.js").OwnerCall>;
|
|
18
19
|
transferOwnershipCall(newOwner: Address): Promise<import("../../types.js").OwnerCall>;
|
|
19
20
|
upgradeCall(newImplementation: Address, data?: Hex): Promise<import("../../types.js").OwnerCall>;
|
|
@@ -33,6 +33,7 @@ export declare class ProtocolAdminCancellerSubPackage {
|
|
|
33
33
|
export declare class ProtocolAdminGuardianSubPackage {
|
|
34
34
|
walletClient: WalletClient;
|
|
35
35
|
constructor(walletClient: WalletClient);
|
|
36
|
+
pauseInstantly(target: Address): Promise<`0x${string}`>;
|
|
36
37
|
unpauseInstantly(target: Address): Promise<`0x${string}`>;
|
|
37
38
|
revokeCancellersInstantly(accounts: readonly Address[]): Promise<`0x${string}`>;
|
|
38
39
|
disableAdminInstantly(target?: Address): Promise<`0x${string}`>;
|
|
@@ -73,6 +74,7 @@ export declare class AdminProtocolAdminSubPackage {
|
|
|
73
74
|
enableAdminCall(target?: Address): Promise<OwnerCall>;
|
|
74
75
|
unpauseCall(target?: Address): Promise<OwnerCall>;
|
|
75
76
|
setDefaultPriceCapUSDCentsCall(cap: bigint, target?: Address): Promise<OwnerCall>;
|
|
77
|
+
setDefaultAdminAllowanceUSDCentsCall(allowance: bigint, target?: Address): Promise<OwnerCall>;
|
|
76
78
|
setPaymentAdapterCall(paymentAdapter: Address, target?: Address): Promise<OwnerCall>;
|
|
77
79
|
operationId(call: OwnerCall, opts?: OperationOptions): Promise<`0x${string}`>;
|
|
78
80
|
operationIdBatch(calls: readonly OwnerCall[], opts?: OperationOptions): Promise<`0x${string}`>;
|
|
@@ -10,7 +10,19 @@ export declare class AdminRegistrySubPackage {
|
|
|
10
10
|
disableAdmin(): Promise<`0x${string}`>;
|
|
11
11
|
enableAdmin(): Promise<`0x${string}`>;
|
|
12
12
|
acceptAdminUpdate(): Promise<`0x${string}`>;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Records a purchase paid for by card or an external wallet, or one line of
|
|
15
|
+
* a coupon purchase. One transaction.
|
|
16
|
+
*/
|
|
17
|
+
recordSettledPurchase(eSIMWalletAddress: Address, dataBundleDetail: DataBundleDetails, asset: Hex, tokenAmount: bigint, paymentReference: Hex): Promise<Hex>;
|
|
18
|
+
/**
|
|
19
|
+
* Records a purchase split between a coupon and a card or external wallet
|
|
20
|
+
* payment, as two lines. `dataBundleDetail` carries the full price and how
|
|
21
|
+
* the remainder was paid; `asset` and `tokenAmount` are what the user paid
|
|
22
|
+
* for the remainder. Lines already recorded are skipped. Returns the hash
|
|
23
|
+
* of the last transaction sent; any earlier one is already mined.
|
|
24
|
+
*/
|
|
25
|
+
recordSettledPurchase(eSIMWalletAddress: Address, dataBundleDetail: DataBundleDetails, asset: Hex, tokenAmount: bigint, paymentReferences: readonly [couponRef: Hex, remainderRef: Hex], couponUSDCents: bigint): Promise<Hex>;
|
|
14
26
|
assignESIMIdentifier(eSIMWalletAddress: Address, eSIMUniqueIdentifier: string): Promise<`0x${string}`>;
|
|
15
27
|
pause(): Promise<`0x${string}`>;
|
|
16
28
|
unpause(): Promise<`0x${string}`>;
|
|
@@ -34,6 +46,7 @@ export declare class AdminRegistrySubPackage {
|
|
|
34
46
|
isESIMWalletOnStandby(eSIMWallet: Address): Promise<boolean>;
|
|
35
47
|
paused(): Promise<boolean>;
|
|
36
48
|
defaultPriceCapUSDCents(): Promise<bigint>;
|
|
49
|
+
defaultAdminAllowanceUSDCents(): Promise<bigint>;
|
|
37
50
|
paymentAdapter(): Promise<`0x${string}`>;
|
|
38
51
|
usedPaymentReferences(scopedReference: Hex): Promise<boolean>;
|
|
39
52
|
isDeviceIdentifierAlreadyUsed(deviceUniqueIdentifier: string): Promise<boolean>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Address, Hash, TransactionReceipt, WalletClient } from "viem";
|
|
1
|
+
import { Address, Hash, Hex, TransactionReceipt, WalletClient } from "viem";
|
|
2
|
+
import { PaymentReferenceKind } from "../../logic/admin/utils/paymentReference.js";
|
|
2
3
|
/**
|
|
3
|
-
* Checks what a mined transaction actually paid
|
|
4
|
-
* when it came from a user: a receipt
|
|
5
|
-
* your own node.
|
|
4
|
+
* Checks what a mined transaction actually paid, and builds and reads payment
|
|
5
|
+
* references. Nothing is sent. Pass a hash when it came from a user: a receipt
|
|
6
|
+
* is used as given, so it must come from your own node.
|
|
6
7
|
*/
|
|
7
8
|
export declare class AdminUtilsSubPackage {
|
|
8
9
|
walletClient: WalletClient;
|
|
@@ -18,4 +19,18 @@ export declare class AdminUtilsSubPackage {
|
|
|
18
19
|
* one token as one dollar, so they mean nothing for a token that is not.
|
|
19
20
|
*/
|
|
20
21
|
verifyERC20Transfer(transaction: Hash | TransactionReceipt, token: Address, sender: Address, destination: Address): Promise<import("../../types.js").ERC20TransferCheck>;
|
|
22
|
+
/**
|
|
23
|
+
* Marks `reference` with how the purchase was paid for. Its high 20 bytes
|
|
24
|
+
* must be zero. For a split purchase, tag the same reference once as
|
|
25
|
+
* `CouponPart` and once as `Remainder`.
|
|
26
|
+
*/
|
|
27
|
+
tagPaymentReference(reference: Hex, kind: PaymentReferenceKind): `0x${string}`;
|
|
28
|
+
/**
|
|
29
|
+
* How a purchase was paid for, and the untagged reference it was built
|
|
30
|
+
* from. Throws on a tag this SDK did not write.
|
|
31
|
+
*/
|
|
32
|
+
parsePaymentReference(reference: Hex): {
|
|
33
|
+
kind: PaymentReferenceKind;
|
|
34
|
+
reference: Hex;
|
|
35
|
+
};
|
|
21
36
|
}
|
|
@@ -23,7 +23,7 @@ export declare class DeviceWalletSubPackage {
|
|
|
23
23
|
getVaultAddress(): Promise<`0x${string}`>;
|
|
24
24
|
removeESIMWallet(eSIMWalletAddress: Address, callBackETH: boolean): Promise<`0x${string}`>;
|
|
25
25
|
toggleAccessToFunds(eSIMWalletAddress: Address, hasAccessToFunds: boolean): Promise<`0x${string}`>;
|
|
26
|
-
transferOwnership(newOwner: P256Key): Promise<`0x${string}`>;
|
|
26
|
+
transferOwnership(newOwner: P256Key, newOwnerSignature: Hex): Promise<`0x${string}`>;
|
|
27
27
|
withdrawDepositTo(withdrawAddress: Address, amount: bigint): Promise<`0x${string}`>;
|
|
28
28
|
canPullFunds(eSIMWalletAddress: Address): Promise<boolean>;
|
|
29
29
|
deviceUniqueIdentifier(): Promise<string>;
|
|
@@ -34,5 +34,6 @@ export declare class DeviceWalletSubPackage {
|
|
|
34
34
|
isValidESIMWallet(eSIMWalletAddress: Address): Promise<boolean>;
|
|
35
35
|
isValidSignature(messageHash: Hex, signature: Hex): Promise<`0x${string}`>;
|
|
36
36
|
registry(): Promise<`0x${string}`>;
|
|
37
|
+
rotationChallenge(newOwner: P256Key): Promise<`0x${string}`>;
|
|
37
38
|
verifier(): Promise<`0x${string}`>;
|
|
38
39
|
}
|
|
@@ -22,6 +22,8 @@ export declare class ESIMWalletSubPackage {
|
|
|
22
22
|
*/
|
|
23
23
|
buyDataBundleWithTransfer(dataBundleDetails: DataBundleDetails, asset: Hex, maxAmountIn: bigint, paymentReference: Hex): Promise<`0x${string}`>;
|
|
24
24
|
priceCapUSDCents(): Promise<bigint>;
|
|
25
|
+
adminAllowanceUSDCents(): Promise<bigint>;
|
|
26
|
+
setAdminAllowanceUSDCents(allowance: bigint): Promise<`0x${string}`>;
|
|
25
27
|
deviceWallet(): Promise<`0x${string}`>;
|
|
26
28
|
owner(): Promise<`0x${string}`>;
|
|
27
29
|
requestTransferOwnership(newOwner: Address): Promise<`0x${string}`>;
|
|
@@ -23,6 +23,7 @@ export declare class RegistrySubPackage {
|
|
|
23
23
|
isESIMIdentifierClaimed(eSIMUniqueIdentifier: string): Promise<boolean>;
|
|
24
24
|
eSIMWalletForIdentifier(eSIMUniqueIdentifier: string): Promise<`0x${string}`>;
|
|
25
25
|
defaultPriceCapUSDCents(): Promise<bigint>;
|
|
26
|
+
defaultAdminAllowanceUSDCents(): Promise<bigint>;
|
|
26
27
|
paymentAdapter(): Promise<`0x${string}`>;
|
|
27
28
|
usedPaymentReferences(scopedReference: Hex): Promise<boolean>;
|
|
28
29
|
requireLazyHistoryCopied(eSIMWallet: Address): Promise<void>;
|
|
@@ -8,5 +8,8 @@ import { DataBundleDetails } from "../../types.js";
|
|
|
8
8
|
* unit - read it from `paymentAdapter.quote(asset, dataBundleDetails.priceUSDCents)`
|
|
9
9
|
* first. `paymentReference` ties this purchase to its offchain order and is
|
|
10
10
|
* spendable once per eSIM wallet.
|
|
11
|
+
*
|
|
12
|
+
* Throws `AdminAllowanceExceededError` without sending when the price is above
|
|
13
|
+
* what the wallet's owner still allows the admin to charge.
|
|
11
14
|
*/
|
|
12
15
|
export declare const _buyDataBundleWithToken: (client: WalletClient, eSIMWalletAddress: Address, dataBundleDetails: DataBundleDetails, asset: Hex, maxAmountIn: bigint, paymentReference: Hex) => Promise<`0x${string}`>;
|
|
@@ -6,6 +6,12 @@ export declare const _registerAsset: (client: WalletClient, symbol: Hex, asset:
|
|
|
6
6
|
export declare const _updateAsset: (client: WalletClient, symbol: Hex, asset: Asset) => Promise<`0x${string}`>;
|
|
7
7
|
/** Add or change a currency, scheduled through the timelock. Pass the result to `schedule`. */
|
|
8
8
|
export declare const _registerAssetCall: (client: WalletClient, symbol: Hex, asset: Asset) => Promise<OwnerCall>;
|
|
9
|
+
/**
|
|
10
|
+
* Send back `amount` of `token` someone sent to the adapter by mistake. Pass the
|
|
11
|
+
* result to `schedule`. Purchases never leave tokens in the adapter, so anything
|
|
12
|
+
* it holds arrived by mistake.
|
|
13
|
+
*/
|
|
14
|
+
export declare const _recoverTokensCall: (client: WalletClient, token: Address, to: Address, amount: bigint) => Promise<OwnerCall>;
|
|
9
15
|
/** Change a currency already in the table, scheduled through the timelock. Pass the result to `schedule`. */
|
|
10
16
|
export declare const _updateAssetCall: (client: WalletClient, symbol: Hex, asset: Asset) => Promise<OwnerCall>;
|
|
11
17
|
/**
|
|
@@ -57,6 +57,13 @@ export declare const _executeRaw: (client: WalletClient, target: Address, value:
|
|
|
57
57
|
* proposer also holds.
|
|
58
58
|
*/
|
|
59
59
|
export declare const _cancel: (client: WalletClient, id: Hex) => Promise<`0x${string}`>;
|
|
60
|
+
/**
|
|
61
|
+
* Pause a protocol contract straight away. `GUARDIAN_ROLE`.
|
|
62
|
+
*
|
|
63
|
+
* Only stops the contract, which the admin key could already do, and a guardian
|
|
64
|
+
* can release it at once with `_unpauseInstantly`.
|
|
65
|
+
*/
|
|
66
|
+
export declare const _pauseInstantly: (client: WalletClient, target: Address) => Promise<`0x${string}`>;
|
|
60
67
|
/**
|
|
61
68
|
* Release a pause on a protocol contract straight away. `GUARDIAN_ROLE`.
|
|
62
69
|
*
|
|
@@ -138,6 +145,13 @@ export declare const _unpauseCall: (client: WalletClient, target?: Address) => P
|
|
|
138
145
|
* `target` defaults to the registry.
|
|
139
146
|
*/
|
|
140
147
|
export declare const _setDefaultPriceCapUSDCentsCall: (client: WalletClient, cap: bigint, target?: Address) => Promise<OwnerCall>;
|
|
148
|
+
/**
|
|
149
|
+
* Set what the admin key may charge each newly created eSIM wallet, in USD
|
|
150
|
+
* cents. Pass the result to `schedule`. Existing wallets keep their own figure.
|
|
151
|
+
*
|
|
152
|
+
* `target` defaults to the registry.
|
|
153
|
+
*/
|
|
154
|
+
export declare const _setDefaultAdminAllowanceUSDCentsCall: (client: WalletClient, allowance: bigint, target?: Address) => Promise<OwnerCall>;
|
|
141
155
|
/**
|
|
142
156
|
* Point the registry at a new payment adapter. Pass the result to `schedule`.
|
|
143
157
|
*
|
|
@@ -11,6 +11,11 @@ export declare const _eSIMUniqueIdentifier: (client: WalletClient, eSIMWalletAdd
|
|
|
11
11
|
* `buyDataBundleWithToken`, since a price over the ceiling reverts.
|
|
12
12
|
*/
|
|
13
13
|
export declare const _priceCapUSDCents: (client: WalletClient, eSIMWalletAddress: Address) => Promise<bigint>;
|
|
14
|
+
/**
|
|
15
|
+
* What the admin key may still charge this eSIM wallet, in USD cents. Only the
|
|
16
|
+
* owner can raise it, so a purchase above it needs the user first.
|
|
17
|
+
*/
|
|
18
|
+
export declare const _adminAllowanceUSDCents: (client: WalletClient, eSIMWalletAddress: Address) => Promise<bigint>;
|
|
14
19
|
/** The pending owner proposed via `requestTransferOwnership` (zero if none). */
|
|
15
20
|
export declare const _newRequestedOwner: (client: WalletClient, eSIMWalletAddress: Address) => Promise<Address>;
|
|
16
21
|
/** The current owner (device wallet) of this eSIM wallet. */
|
|
@@ -27,6 +27,8 @@ export declare const _paused: (client: WalletClient) => Promise<boolean>;
|
|
|
27
27
|
* cap of its own. Never zero.
|
|
28
28
|
*/
|
|
29
29
|
export declare const _defaultPriceCapUSDCents: (client: WalletClient) => Promise<bigint>;
|
|
30
|
+
/** What the admin key may charge a newly created eSIM wallet in total, in USD cents. */
|
|
31
|
+
export declare const _defaultAdminAllowanceUSDCents: (client: WalletClient) => Promise<bigint>;
|
|
30
32
|
/** The vault EOA recorded in the registry. */
|
|
31
33
|
export declare const _vault: (client: WalletClient) => Promise<Address>;
|
|
32
34
|
/** The pending admin nominated via `requestAdminUpdate` (zero address if none). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex, WalletClient } from "viem";
|
|
2
|
-
import type
|
|
2
|
+
import { type DataBundleDetails, type OwnerCall } from "../../types.js";
|
|
3
3
|
/** Wire (or rewire) the LazyWalletRegistry into the Registry. `onlyOwner`. */
|
|
4
4
|
export declare const _addOrUpdateLazyWalletRegistryAddress: (client: WalletClient, lazyWalletRegistry: Address) => Promise<`0x${string}`>;
|
|
5
5
|
/** Update the vault that receives eSIM payments. `onlyOwner`. */
|
|
@@ -72,8 +72,29 @@ export declare const _assignESIMIdentifier: (client: WalletClient, eSIMWalletAdd
|
|
|
72
72
|
* never sees a transfer to prove it), and `_tokenAmount` is recorded for
|
|
73
73
|
* offchain matching but never checked against `_dataBundleDetail.priceUSDCents`.
|
|
74
74
|
* `_paymentReference` is spendable once per eSIM wallet.
|
|
75
|
+
*
|
|
76
|
+
* Given `[couponRef, remainderRef]` and `couponUSDCents`, records a purchase
|
|
77
|
+
* split between a coupon and another payment as two lines, see
|
|
78
|
+
* {@link _couponSplitLines}. Lines already recorded are skipped, so a retry
|
|
79
|
+
* after a partial failure sends only what is missing. Returns the last hash
|
|
80
|
+
* sent; any earlier one is already mined.
|
|
81
|
+
*/
|
|
82
|
+
export declare const _recordSettledPurchase: (client: WalletClient, eSIMWalletAddress: Address, dataBundleDetail: DataBundleDetails, asset: Hex, tokenAmount: bigint, paymentReference: Hex | readonly [Hex, Hex], couponUSDCents?: bigint) => Promise<Hex>;
|
|
83
|
+
/** One `recordSettledPurchase` call's worth of arguments, past the eSIM wallet. */
|
|
84
|
+
export interface SettledLine {
|
|
85
|
+
dataBundleDetail: DataBundleDetails;
|
|
86
|
+
asset: Hex;
|
|
87
|
+
tokenAmount: bigint;
|
|
88
|
+
paymentReference: Hex;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Splits one purchase into its remainder line and its coupon line, in that
|
|
92
|
+
* order. `dataBundleDetail` carries the full price and how the remainder was
|
|
93
|
+
* paid; `asset` and `tokenAmount` are what the user paid for the remainder.
|
|
94
|
+
* The coupon line is always `Fiat` in `USD`, with the coupon's cents as its
|
|
95
|
+
* token amount.
|
|
75
96
|
*/
|
|
76
|
-
export declare const
|
|
97
|
+
export declare const _couponSplitLines: (dataBundleDetail: DataBundleDetails, asset: Hex, tokenAmount: bigint, [couponRef, remainderRef]: readonly [Hex, Hex], couponUSDCents: bigint | undefined) => [remainder: SettledLine, coupon: SettledLine];
|
|
77
98
|
/**
|
|
78
99
|
* Step 2 of the 2-step admin handover: the nominee accepts. The chain requires
|
|
79
100
|
* `msg.sender` to equal the pending admin, so the `client` here must be the
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Hex } from "viem";
|
|
2
|
+
/** How a purchase was paid for, as written into its payment reference. */
|
|
3
|
+
export declare enum PaymentReferenceKind {
|
|
4
|
+
/** Paid in full without a coupon. Carries no tag. */
|
|
5
|
+
Standard = "Standard",
|
|
6
|
+
/** Paid in full by a coupon. */
|
|
7
|
+
Coupon = "Coupon",
|
|
8
|
+
/** The coupon's share of a purchase split between a coupon and another payment. */
|
|
9
|
+
CouponPart = "CouponPart",
|
|
10
|
+
/** What the user paid on top of the coupon in a split purchase. */
|
|
11
|
+
Remainder = "Remainder"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Writes `kind`'s tag into the high 20 bytes of `reference`, which must be zero
|
|
15
|
+
* there. Tag both halves of a split purchase from the same reference, so each
|
|
16
|
+
* spends once onchain and both still point at the same order.
|
|
17
|
+
*/
|
|
18
|
+
export declare const _tagPaymentReference: (reference: Hex, kind: PaymentReferenceKind) => Hex;
|
|
19
|
+
/**
|
|
20
|
+
* Reads back how a purchase was paid for, and the untagged reference it was
|
|
21
|
+
* built from. Throws on a tag this SDK did not write.
|
|
22
|
+
*/
|
|
23
|
+
export declare const _parsePaymentReference: (reference: Hex) => {
|
|
24
|
+
kind: PaymentReferenceKind;
|
|
25
|
+
reference: Hex;
|
|
26
|
+
};
|
|
@@ -44,12 +44,12 @@ export declare const _removeESIMWallet: (client: KokioSmartAccountClient, addres
|
|
|
44
44
|
* Rotate the P256 key that owns this wallet. The registry is told in the same
|
|
45
45
|
* call, so its record of the owner cannot drift from the wallet's.
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* `newOwnerSignature` is the new passkey's WebAuthn assertion over
|
|
48
|
+
* `rotationChallenge(newOwner)`, ABI-encoded as a `WebAuthnSignature` with no
|
|
49
|
+
* version or validUntil header. Without it the contract reverts with
|
|
50
|
+
* `NewOwnerKeyCannotSign`, so a wallet can only move to a key that can sign.
|
|
51
51
|
*/
|
|
52
|
-
export declare const _transferOwnership: (client: KokioSmartAccountClient, address: Address, newOwner: P256Key) => Promise<`0x${string}`>;
|
|
52
|
+
export declare const _transferOwnership: (client: KokioSmartAccountClient, address: Address, newOwner: P256Key, newOwnerSignature: Hex) => Promise<`0x${string}`>;
|
|
53
53
|
/**
|
|
54
54
|
* Top up the gas deposit the EntryPoint holds for this wallet, from the wallet's
|
|
55
55
|
* own balance. Anyone may pay into any account's deposit, so an EOA can do this
|
|
@@ -81,6 +81,12 @@ export declare const _canPullFunds: (client: KokioSmartAccountClient, address: A
|
|
|
81
81
|
* the same owner key's wallet at a different salt.
|
|
82
82
|
*/
|
|
83
83
|
export declare const _isValidSignature: (client: KokioSmartAccountClient, address: Address, messageHash: Hex, signature: Hex) => Promise<Hex>;
|
|
84
|
+
/**
|
|
85
|
+
* The bytes the new passkey must sign before `transferOwnership` accepts it.
|
|
86
|
+
* Bound to this wallet, this chain and `newOwner`, so it cannot be reused for
|
|
87
|
+
* another rotation.
|
|
88
|
+
*/
|
|
89
|
+
export declare const _rotationChallenge: (client: KokioSmartAccountClient, address: Address, newOwner: P256Key) => Promise<Hex>;
|
|
84
90
|
/** The registry this wallet reports its ownership changes to. */
|
|
85
91
|
export declare const _registry: (client: KokioSmartAccountClient, address: Address) => Promise<Address>;
|
|
86
92
|
/** The factory that deploys this wallet's eSIM wallets. */
|
|
@@ -11,6 +11,14 @@ import { KokioSmartAccountClient } from "../types.js";
|
|
|
11
11
|
* owner has to set it again.
|
|
12
12
|
*/
|
|
13
13
|
export declare const _setPriceCapUSDCents: (client: KokioSmartAccountClient, address: Address, cap: bigint) => Promise<`0x${string}`>;
|
|
14
|
+
/**
|
|
15
|
+
* Set the total the admin key may charge this eSIM wallet, in USD cents. It
|
|
16
|
+
* replaces what is left rather than adding to it, and zero stops admin charges.
|
|
17
|
+
*
|
|
18
|
+
* `onlyDeviceWallet`, so only the user can raise what the admin may spend. A
|
|
19
|
+
* handover resets it to the registry default.
|
|
20
|
+
*/
|
|
21
|
+
export declare const _setAdminAllowanceUSDCents: (client: KokioSmartAccountClient, address: Address, allowance: bigint) => Promise<`0x${string}`>;
|
|
14
22
|
/**
|
|
15
23
|
* Buy a data bundle in `asset`, an ERC-20 the payment adapter accepts.
|
|
16
24
|
*
|
|
@@ -53,6 +61,12 @@ export declare const _owner: (client: KokioSmartAccountClient, address: Address)
|
|
|
53
61
|
* state is reachable.
|
|
54
62
|
*/
|
|
55
63
|
export declare const _priceCapUSDCents: (client: KokioSmartAccountClient, address: Address) => Promise<bigint>;
|
|
64
|
+
/**
|
|
65
|
+
* What the admin key may still charge this eSIM wallet, in USD cents. Each admin
|
|
66
|
+
* purchase lowers it and nothing refills it, so the owner tops it up with
|
|
67
|
+
* `setAdminAllowanceUSDCents`. The owner's own purchases do not touch it.
|
|
68
|
+
*/
|
|
69
|
+
export declare const _adminAllowanceUSDCents: (client: KokioSmartAccountClient, address: Address) => Promise<bigint>;
|
|
56
70
|
/**
|
|
57
71
|
* The device wallet this eSIM wallet belongs to. Tracks `owner`, but it is its
|
|
58
72
|
* own storage slot with its own getter, so read whichever one you mean.
|
|
@@ -149,6 +149,33 @@ export declare class PriceOutOfRangeError extends KokioError {
|
|
|
149
149
|
readonly priceUSDCents: bigint;
|
|
150
150
|
constructor(priceUSDCents: bigint);
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* An admin purchase priced above what the eSIM wallet's owner still allows the
|
|
154
|
+
* admin key to charge. Thrown before sending, since the contract would revert
|
|
155
|
+
* with `AdminAllowanceExceeded`. The owner raises it with `setAdminAllowanceUSDCents`.
|
|
156
|
+
*/
|
|
157
|
+
export declare class AdminAllowanceExceededError extends KokioError {
|
|
158
|
+
readonly priceUSDCents: bigint;
|
|
159
|
+
readonly remainingUSDCents: bigint;
|
|
160
|
+
constructor(priceUSDCents: bigint, remainingUSDCents: bigint);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A payment reference that is not 32 bytes, has an empty order part, or
|
|
164
|
+
* carries a tag this SDK cannot write over or read back.
|
|
165
|
+
*/
|
|
166
|
+
export declare class InvalidPaymentReferenceError extends KokioError {
|
|
167
|
+
readonly reference: string;
|
|
168
|
+
constructor(reference: string, reason: string);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A coupon that covers none or all of the price. Neither is a split: a coupon
|
|
172
|
+
* covering the whole price is a full-coupon order with a single reference.
|
|
173
|
+
*/
|
|
174
|
+
export declare class CouponSplitOutOfRangeError extends KokioError {
|
|
175
|
+
readonly couponUSDCents?: bigint;
|
|
176
|
+
readonly priceUSDCents: bigint;
|
|
177
|
+
constructor(couponUSDCents: bigint | undefined, priceUSDCents: bigint);
|
|
178
|
+
}
|
|
152
179
|
export interface DecodedRevert {
|
|
153
180
|
errorName: string;
|
|
154
181
|
args: readonly unknown[];
|
|
@@ -70,6 +70,8 @@ export declare const _isESIMIdentifierClaimed: (client: KokioSmartAccountClient,
|
|
|
70
70
|
export declare const _eSIMWalletForIdentifier: (client: KokioSmartAccountClient, eSIMUniqueIdentifier: string) => Promise<Address>;
|
|
71
71
|
/** The fallback price ceiling in USD cents for a wallet holding no cap of its own. */
|
|
72
72
|
export declare const _defaultPriceCapUSDCents: (client: KokioSmartAccountClient) => Promise<bigint>;
|
|
73
|
+
/** What the admin key may charge a newly created eSIM wallet in total, in USD cents. */
|
|
74
|
+
export declare const _defaultAdminAllowanceUSDCents: (client: KokioSmartAccountClient) => Promise<bigint>;
|
|
73
75
|
/** The payment adapter this registry currently points at. */
|
|
74
76
|
export declare const _paymentAdapter: (client: KokioSmartAccountClient) => Promise<Address>;
|
|
75
77
|
/**
|