@astrox/connection 0.0.20 → 0.0.24
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/lib/tsconfig.tsbuildinfo +1 -2838
- package/package.json +2 -2
- package/lib/cjs/canisters/internet_identity_idl.d.ts +0 -7
- package/lib/cjs/canisters/internet_identity_idl.js +0 -101
- package/lib/cjs/canisters/internet_identity_idl.js.map +0 -1
- package/lib/cjs/canisters/ledger.idl.d.ts +0 -7
- package/lib/cjs/canisters/ledger.idl.js +0 -81
- package/lib/cjs/canisters/ledger.idl.js.map +0 -1
- package/lib/cjs/canisters/me.idl.d.ts +0 -7
- package/lib/cjs/canisters/me.idl.js +0 -125
- package/lib/cjs/canisters/me.idl.js.map +0 -1
- package/lib/cjs/canisters/nns-dapp-cert.idl.d.ts +0 -7
- package/lib/cjs/canisters/nns-dapp-cert.idl.js +0 -86
- package/lib/cjs/canisters/nns-dapp-cert.idl.js.map +0 -1
- package/lib/cjs/canisters/nns-dapp.idl.d.ts +0 -7
- package/lib/cjs/canisters/nns-dapp.idl.js +0 -184
- package/lib/cjs/canisters/nns-dapp.idl.js.map +0 -1
- package/lib/cjs/connections/baseConnection.d.ts +0 -23
- package/lib/cjs/connections/baseConnection.js +0 -87
- package/lib/cjs/connections/baseConnection.js.map +0 -1
- package/lib/cjs/connections/ledgerConnection.d.ts +0 -53
- package/lib/cjs/connections/ledgerConnection.js +0 -137
- package/lib/cjs/connections/ledgerConnection.js.map +0 -1
- package/lib/cjs/connections/nnsConnection.d.ts +0 -63
- package/lib/cjs/connections/nnsConnection.js +0 -161
- package/lib/cjs/connections/nnsConnection.js.map +0 -1
- package/lib/cjs/ic/icAuthClient.d.ts +0 -31
- package/lib/cjs/ic/icAuthClient.js +0 -235
- package/lib/cjs/ic/icAuthClient.js.map +0 -1
- package/lib/cjs/ic/icConnect.d.ts +0 -35
- package/lib/cjs/ic/icConnect.js +0 -194
- package/lib/cjs/ic/icConnect.js.map +0 -1
- package/lib/cjs/ic/icStorage.d.ts +0 -16
- package/lib/cjs/ic/icStorage.js +0 -49
- package/lib/cjs/ic/icStorage.js.map +0 -1
- package/lib/cjs/ic/icWindow.d.ts +0 -7
- package/lib/cjs/ic/icWindow.js +0 -20
- package/lib/cjs/ic/icWindow.js.map +0 -1
- package/lib/cjs/ic/index.d.ts +0 -2
- package/lib/cjs/ic/index.js +0 -7
- package/lib/cjs/ic/index.js.map +0 -1
- package/lib/cjs/ic/types.d.ts +0 -129
- package/lib/cjs/ic/types.js +0 -17
- package/lib/cjs/ic/types.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -5
- package/lib/cjs/index.js +0 -18
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/types/index.d.ts +0 -175
- package/lib/cjs/types/index.js +0 -17
- package/lib/cjs/types/index.js.map +0 -1
- package/lib/cjs/utils/common/types.d.ts +0 -15
- package/lib/cjs/utils/common/types.js +0 -12
- package/lib/cjs/utils/common/types.js.map +0 -1
- package/lib/cjs/utils/constants.d.ts +0 -6
- package/lib/cjs/utils/constants.js +0 -13
- package/lib/cjs/utils/constants.js.map +0 -1
- package/lib/cjs/utils/converter.d.ts +0 -32
- package/lib/cjs/utils/converter.js +0 -130
- package/lib/cjs/utils/converter.js.map +0 -1
- package/lib/cjs/utils/index.d.ts +0 -3
- package/lib/cjs/utils/index.js +0 -16
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/esm/canisters/internet_identity_idl.d.ts +0 -7
- package/lib/esm/canisters/internet_identity_idl.js +0 -98
- package/lib/esm/canisters/internet_identity_idl.js.map +0 -1
- package/lib/esm/canisters/ledger.idl.d.ts +0 -7
- package/lib/esm/canisters/ledger.idl.js +0 -78
- package/lib/esm/canisters/ledger.idl.js.map +0 -1
- package/lib/esm/canisters/me.idl.d.ts +0 -7
- package/lib/esm/canisters/me.idl.js +0 -122
- package/lib/esm/canisters/me.idl.js.map +0 -1
- package/lib/esm/canisters/nns-dapp-cert.idl.d.ts +0 -7
- package/lib/esm/canisters/nns-dapp-cert.idl.js +0 -83
- package/lib/esm/canisters/nns-dapp-cert.idl.js.map +0 -1
- package/lib/esm/canisters/nns-dapp.idl.d.ts +0 -7
- package/lib/esm/canisters/nns-dapp.idl.js +0 -181
- package/lib/esm/canisters/nns-dapp.idl.js.map +0 -1
- package/lib/esm/connections/baseConnection.d.ts +0 -23
- package/lib/esm/connections/baseConnection.js +0 -80
- package/lib/esm/connections/baseConnection.js.map +0 -1
- package/lib/esm/connections/ledgerConnection.d.ts +0 -53
- package/lib/esm/connections/ledgerConnection.js +0 -130
- package/lib/esm/connections/ledgerConnection.js.map +0 -1
- package/lib/esm/connections/nnsConnection.d.ts +0 -63
- package/lib/esm/connections/nnsConnection.js +0 -154
- package/lib/esm/connections/nnsConnection.js.map +0 -1
- package/lib/esm/ic/icAuthClient.d.ts +0 -31
- package/lib/esm/ic/icAuthClient.js +0 -231
- package/lib/esm/ic/icAuthClient.js.map +0 -1
- package/lib/esm/ic/icConnect.d.ts +0 -35
- package/lib/esm/ic/icConnect.js +0 -190
- package/lib/esm/ic/icConnect.js.map +0 -1
- package/lib/esm/ic/icStorage.d.ts +0 -16
- package/lib/esm/ic/icStorage.js +0 -44
- package/lib/esm/ic/icStorage.js.map +0 -1
- package/lib/esm/ic/icWindow.d.ts +0 -7
- package/lib/esm/ic/icWindow.js +0 -16
- package/lib/esm/ic/icWindow.js.map +0 -1
- package/lib/esm/ic/index.d.ts +0 -2
- package/lib/esm/ic/index.js +0 -3
- package/lib/esm/ic/index.js.map +0 -1
- package/lib/esm/ic/types.d.ts +0 -129
- package/lib/esm/ic/types.js +0 -14
- package/lib/esm/ic/types.js.map +0 -1
- package/lib/esm/index.d.ts +0 -5
- package/lib/esm/index.js +0 -6
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/types/index.d.ts +0 -175
- package/lib/esm/types/index.js +0 -14
- package/lib/esm/types/index.js.map +0 -1
- package/lib/esm/utils/common/types.d.ts +0 -15
- package/lib/esm/utils/common/types.js +0 -9
- package/lib/esm/utils/common/types.js.map +0 -1
- package/lib/esm/utils/constants.d.ts +0 -6
- package/lib/esm/utils/constants.js +0 -10
- package/lib/esm/utils/constants.js.map +0 -1
- package/lib/esm/utils/converter.d.ts +0 -32
- package/lib/esm/utils/converter.js +0 -124
- package/lib/esm/utils/converter.js.map +0 -1
- package/lib/esm/utils/index.d.ts +0 -3
- package/lib/esm/utils/index.js +0 -4
- package/lib/esm/utils/index.js.map +0 -1
- package/lib/tsconfig-cjs.tsbuildinfo +0 -2839
package/lib/cjs/types/index.d.ts
DELETED
@@ -1,175 +0,0 @@
|
|
1
|
-
import { ActorSubclass, HttpAgent, SignIdentity } from '@dfinity/agent';
|
2
|
-
import { Principal } from '@dfinity/principal';
|
3
|
-
import { AccountIdentifier, Memo } from '../utils/common/types';
|
4
|
-
import { DelegationChain, DelegationIdentity } from '@dfinity/identity';
|
5
|
-
import { IC } from 'src/ic';
|
6
|
-
export interface IIDelegationResult {
|
7
|
-
delegation: {
|
8
|
-
pubkey: Uint8Array;
|
9
|
-
expiration: bigint;
|
10
|
-
targets?: Principal[];
|
11
|
-
};
|
12
|
-
signature: Uint8Array;
|
13
|
-
}
|
14
|
-
export interface DelegationMessage {
|
15
|
-
kind: string;
|
16
|
-
delegations: IIDelegationResult[];
|
17
|
-
userPublicKey: Uint8Array;
|
18
|
-
}
|
19
|
-
export interface HandleDelegationResult {
|
20
|
-
delegationChain: DelegationChain;
|
21
|
-
delegationIdentity: DelegationIdentity;
|
22
|
-
}
|
23
|
-
export interface AbstractConnection<T> {
|
24
|
-
identity: SignIdentity;
|
25
|
-
delegationIdentity: DelegationIdentity;
|
26
|
-
actor?: ActorSubclass<T>;
|
27
|
-
agent?: HttpAgent;
|
28
|
-
canisterId?: string;
|
29
|
-
getActor(): Promise<ActorSubclass<T>>;
|
30
|
-
}
|
31
|
-
export interface CreateActorResult<T> {
|
32
|
-
actor: ActorSubclass<T>;
|
33
|
-
agent: HttpAgent;
|
34
|
-
}
|
35
|
-
export interface SendOpts {
|
36
|
-
fee?: bigint;
|
37
|
-
memo?: Memo;
|
38
|
-
from_subaccount?: number;
|
39
|
-
created_at_time?: Date;
|
40
|
-
}
|
41
|
-
/**
|
42
|
-
* List of options for creating an {@link AuthClient}.
|
43
|
-
*/
|
44
|
-
export interface AuthClientCreateOptions {
|
45
|
-
/**
|
46
|
-
* An identity to use as the base
|
47
|
-
*/
|
48
|
-
identity?: SignIdentity;
|
49
|
-
/**
|
50
|
-
* Optional storage with get, set, and remove. Uses SessionStorage by default
|
51
|
-
*/
|
52
|
-
storage?: AuthClientStorage;
|
53
|
-
appId?: string;
|
54
|
-
idpWindowOption?: string;
|
55
|
-
}
|
56
|
-
export interface AuthClientLoginOptions extends AuthClientCreateOptions {
|
57
|
-
/**
|
58
|
-
* Identity provider. By default, use the identity service.
|
59
|
-
*/
|
60
|
-
identityProvider?: string | URL;
|
61
|
-
permissions?: PermissionsType[];
|
62
|
-
/**
|
63
|
-
* Experiation of the authentication
|
64
|
-
*/
|
65
|
-
maxTimeToLive?: bigint;
|
66
|
-
/**
|
67
|
-
* Callback once login has completed
|
68
|
-
*/
|
69
|
-
onSuccess?: () => void | Promise<void>;
|
70
|
-
/**
|
71
|
-
* Callback in case authentication fails
|
72
|
-
*/
|
73
|
-
onError?: (error?: string) => void;
|
74
|
-
/**
|
75
|
-
* Callback once is authenticated
|
76
|
-
*/
|
77
|
-
onAuthenticated?: (ic: IC) => void | Promise<void>;
|
78
|
-
}
|
79
|
-
export interface ConnectOptions extends AuthClientLoginOptions {
|
80
|
-
ledgerCanisterId?: string;
|
81
|
-
walletProviderUrl?: string;
|
82
|
-
}
|
83
|
-
export interface TransactionOptions {
|
84
|
-
/**
|
85
|
-
* Identity provider. By default, use the identity service.
|
86
|
-
*/
|
87
|
-
walletProvider?: string | URL;
|
88
|
-
from: AccountIdentifier;
|
89
|
-
to: AccountIdentifier;
|
90
|
-
amount: bigint;
|
91
|
-
sendOpts: SendOpts;
|
92
|
-
/**
|
93
|
-
* Callback once login has completed
|
94
|
-
*/
|
95
|
-
onSuccess?: () => void | Promise<void>;
|
96
|
-
/**
|
97
|
-
* Callback in case authentication fails
|
98
|
-
*/
|
99
|
-
onError?: (error?: string) => void;
|
100
|
-
}
|
101
|
-
/**
|
102
|
-
* Interface for persisting user authentication data
|
103
|
-
*/
|
104
|
-
export interface AuthClientStorage {
|
105
|
-
get(key: string): Promise<string | null>;
|
106
|
-
set(key: string, value: string): Promise<void>;
|
107
|
-
remove(key: string): Promise<void>;
|
108
|
-
}
|
109
|
-
export interface InternetIdentityAuthRequest {
|
110
|
-
kind: 'authorize-client';
|
111
|
-
sessionPublicKey: Uint8Array;
|
112
|
-
permissions?: PermissionsType[];
|
113
|
-
maxTimeToLive?: bigint;
|
114
|
-
appId?: string;
|
115
|
-
}
|
116
|
-
export interface DelegationResult {
|
117
|
-
delegations: {
|
118
|
-
delegation: {
|
119
|
-
pubkey: Uint8Array;
|
120
|
-
expiration: bigint;
|
121
|
-
targets?: Principal[];
|
122
|
-
};
|
123
|
-
signature: Uint8Array;
|
124
|
-
}[];
|
125
|
-
userPublicKey: Uint8Array;
|
126
|
-
}
|
127
|
-
export interface MeAuthResponseSuccess {
|
128
|
-
kind: 'authorize-client-success';
|
129
|
-
identity: DelegationResult;
|
130
|
-
wallet?: string;
|
131
|
-
}
|
132
|
-
export interface IIAuthResponseSuccess extends DelegationResult {
|
133
|
-
kind: 'authorize-client-success';
|
134
|
-
}
|
135
|
-
export declare type AuthResponseSuccess = MeAuthResponseSuccess | IIAuthResponseSuccess;
|
136
|
-
export declare type EventHandler = (event: MessageEvent) => Promise<void>;
|
137
|
-
export declare enum PermissionsType {
|
138
|
-
identity = "permissions-identity",
|
139
|
-
wallet = "permissions-wallet"
|
140
|
-
}
|
141
|
-
export declare enum TransactionMessageKind {
|
142
|
-
client = "transaction-client",
|
143
|
-
ready = "transaction-ready",
|
144
|
-
success = "transaction-client-success",
|
145
|
-
fail = "transaction-client-failure"
|
146
|
-
}
|
147
|
-
export interface TransactionReadyMessage {
|
148
|
-
kind: TransactionMessageKind.ready;
|
149
|
-
}
|
150
|
-
export interface TransactionResponseFailure {
|
151
|
-
kind: TransactionMessageKind.fail;
|
152
|
-
text: string;
|
153
|
-
}
|
154
|
-
export interface TransactionResponseSuccess {
|
155
|
-
kind: TransactionMessageKind.success;
|
156
|
-
payload?: {
|
157
|
-
blockHeight: bigint;
|
158
|
-
originPayload: {
|
159
|
-
to: AccountIdentifier;
|
160
|
-
amount: bigint;
|
161
|
-
sendOpts?: Partial<SendOpts>;
|
162
|
-
};
|
163
|
-
};
|
164
|
-
}
|
165
|
-
export declare type TransactionResponseMessage = TransactionReadyMessage | TransactionResponse;
|
166
|
-
export declare type TransactionResponse = TransactionResponseSuccess | TransactionResponseFailure;
|
167
|
-
export interface AuthReadyMessage {
|
168
|
-
kind: 'authorize-ready';
|
169
|
-
}
|
170
|
-
export interface AuthResponseFailure {
|
171
|
-
kind: 'authorize-client-failure';
|
172
|
-
text: string;
|
173
|
-
}
|
174
|
-
export declare type IdentityServiceResponseMessage = AuthReadyMessage | AuthResponse;
|
175
|
-
export declare type AuthResponse = AuthResponseSuccess | AuthResponseFailure;
|
package/lib/cjs/types/index.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TransactionMessageKind = exports.PermissionsType = void 0;
|
4
|
-
var PermissionsType;
|
5
|
-
(function (PermissionsType) {
|
6
|
-
PermissionsType["identity"] = "permissions-identity";
|
7
|
-
PermissionsType["wallet"] = "permissions-wallet";
|
8
|
-
})(PermissionsType = exports.PermissionsType || (exports.PermissionsType = {}));
|
9
|
-
// Transaction Types
|
10
|
-
var TransactionMessageKind;
|
11
|
-
(function (TransactionMessageKind) {
|
12
|
-
TransactionMessageKind["client"] = "transaction-client";
|
13
|
-
TransactionMessageKind["ready"] = "transaction-ready";
|
14
|
-
TransactionMessageKind["success"] = "transaction-client-success";
|
15
|
-
TransactionMessageKind["fail"] = "transaction-client-failure";
|
16
|
-
})(TransactionMessageKind = exports.TransactionMessageKind || (exports.TransactionMessageKind = {}));
|
17
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAgKA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oDAAiC,CAAA;IACjC,gDAA6B,CAAA;AAC/B,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAED,oBAAoB;AACpB,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,uDAA6B,CAAA;IAC7B,qDAA2B,CAAA;IAC3B,gEAAsC,CAAA;IACtC,6DAAmC,CAAA;AACrC,CAAC,EALW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKjC"}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
export declare type CanisterIdString = string;
|
2
|
-
export declare type NeuronId = bigint;
|
3
|
-
export declare type AccountIdentifier = string;
|
4
|
-
export declare type BlockHeight = bigint;
|
5
|
-
export declare type E8s = bigint;
|
6
|
-
export declare type Memo = bigint;
|
7
|
-
export declare type PrincipalString = string;
|
8
|
-
export declare type SubAccount = Uint8Array;
|
9
|
-
export declare enum WalletType {
|
10
|
-
nns = "nns",
|
11
|
-
plug = "plug",
|
12
|
-
stoic = "stoic",
|
13
|
-
me = "me",
|
14
|
-
unknown = "unknown"
|
15
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.WalletType = void 0;
|
4
|
-
var WalletType;
|
5
|
-
(function (WalletType) {
|
6
|
-
WalletType["nns"] = "nns";
|
7
|
-
WalletType["plug"] = "plug";
|
8
|
-
WalletType["stoic"] = "stoic";
|
9
|
-
WalletType["me"] = "me";
|
10
|
-
WalletType["unknown"] = "unknown";
|
11
|
-
})(WalletType = exports.WalletType || (exports.WalletType = {}));
|
12
|
-
//# sourceMappingURL=types.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/utils/common/types.ts"],"names":[],"mappings":";;;AAQA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,uBAAS,CAAA;IACT,iCAAmB,CAAA;AACrB,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
export declare const SUB_ACCOUNT_BYTE_LENGTH = 32;
|
2
|
-
export declare const CREATE_CANISTER_MEMO: bigint;
|
3
|
-
export declare const TOP_UP_CANISTER_MEMO: bigint;
|
4
|
-
export declare const TRANSACTION_FEE: bigint;
|
5
|
-
export declare const LEDGER_CANISTER_ID = "ryjl3-tyaaa-aaaaa-aaaba-cai";
|
6
|
-
export declare const NNS_CANISTER_ID = "qoctq-giaaa-aaaaa-aaaea-cai";
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.NNS_CANISTER_ID = exports.LEDGER_CANISTER_ID = exports.TRANSACTION_FEE = exports.TOP_UP_CANISTER_MEMO = exports.CREATE_CANISTER_MEMO = exports.SUB_ACCOUNT_BYTE_LENGTH = void 0;
|
4
|
-
exports.SUB_ACCOUNT_BYTE_LENGTH = 32;
|
5
|
-
exports.CREATE_CANISTER_MEMO = BigInt(0x41455243); // CREA,
|
6
|
-
exports.TOP_UP_CANISTER_MEMO = BigInt(0x50555054); // TPUP
|
7
|
-
exports.TRANSACTION_FEE = BigInt(10000);
|
8
|
-
exports.LEDGER_CANISTER_ID = 'ryjl3-tyaaa-aaaaa-aaaba-cai';
|
9
|
-
exports.NNS_CANISTER_ID = 'qoctq-giaaa-aaaaa-aaaea-cai';
|
10
|
-
// import config from "../config";
|
11
|
-
// // @ts-ignore
|
12
|
-
// export const HOST = "HOST" in config ? config["HOST"] : undefined;
|
13
|
-
//# sourceMappingURL=constants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAC7B,QAAA,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ;AACnD,QAAA,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO;AAElD,QAAA,eAAe,GAAG,MAAM,CAAC,KAAM,CAAC,CAAC;AAEjC,QAAA,kBAAkB,GAAG,6BAA6B,CAAC;AACnD,QAAA,eAAe,GAAG,6BAA6B,CAAC;AAE7D,kCAAkC;AAElC,gBAAgB;AAChB,qEAAqE"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { Principal } from '@dfinity/principal';
|
2
|
-
import { AccountIdentifier, SubAccount } from './common/types';
|
3
|
-
export declare const uint8ArrayToBigInt: (array: Uint8Array) => bigint;
|
4
|
-
export declare const bigIntToUint8Array: (value: bigint) => Uint8Array;
|
5
|
-
export declare const arrayBufferToArrayOfNumber: (buffer: ArrayBuffer) => Array<number>;
|
6
|
-
export declare const arrayOfNumberToUint8Array: (numbers: Array<number>) => Uint8Array;
|
7
|
-
export declare const arrayOfNumberToArrayBuffer: (numbers: Array<number>) => ArrayBuffer;
|
8
|
-
export declare const arrayBufferToNumber: (buffer: ArrayBuffer) => number;
|
9
|
-
export declare const numberToArrayBuffer: (value: number, byteLength: number) => ArrayBuffer;
|
10
|
-
export declare const asciiStringToByteArray: (text: string) => Array<number>;
|
11
|
-
export declare const toSubAccountId: (subAccount: Array<number>) => number;
|
12
|
-
export declare const fromSubAccountId: (subAccountId: number) => Array<number>;
|
13
|
-
export declare const accountIdentifierToBytes: (accountIdentifier: AccountIdentifier) => Uint8Array;
|
14
|
-
export declare const accountIdentifierFromBytes: (accountIdentifier: Uint8Array) => AccountIdentifier;
|
15
|
-
export declare const principalToAccountIdentifier: (principal: Principal, subAccount?: Uint8Array | undefined) => string;
|
16
|
-
export declare const principalToSubAccount: (principal: Principal) => SubAccount;
|
17
|
-
export declare const stringToAccountIdentifier: (str: string) => AccountIdentifier | undefined;
|
18
|
-
export declare const calculateCrc32: (bytes: Uint8Array) => Uint8Array;
|
19
|
-
export declare const E8S_PER_ICP = 100000000;
|
20
|
-
export declare enum TokenSymbol {
|
21
|
-
ICP = "ICP"
|
22
|
-
}
|
23
|
-
export interface TokenMapItem {
|
24
|
-
[key: string]: {
|
25
|
-
amount: number;
|
26
|
-
symbol: string;
|
27
|
-
};
|
28
|
-
}
|
29
|
-
export declare const formatAssetBySymbol: (_amount: bigint, symbol: string) => {
|
30
|
-
amount: number;
|
31
|
-
symbol: string;
|
32
|
-
} | undefined;
|
@@ -1,130 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.formatAssetBySymbol = exports.TokenSymbol = exports.E8S_PER_ICP = exports.calculateCrc32 = exports.stringToAccountIdentifier = exports.principalToSubAccount = exports.principalToAccountIdentifier = exports.accountIdentifierFromBytes = exports.accountIdentifierToBytes = exports.fromSubAccountId = exports.toSubAccountId = exports.asciiStringToByteArray = exports.numberToArrayBuffer = exports.arrayBufferToNumber = exports.arrayOfNumberToArrayBuffer = exports.arrayOfNumberToUint8Array = exports.arrayBufferToArrayOfNumber = exports.bigIntToUint8Array = exports.uint8ArrayToBigInt = void 0;
|
7
|
-
const principal_1 = require("@dfinity/principal");
|
8
|
-
const js_sha256_1 = require("js-sha256");
|
9
|
-
const buffer_1 = require("buffer");
|
10
|
-
const crc_1 = __importDefault(require("crc"));
|
11
|
-
const constants_1 = require("./constants");
|
12
|
-
exports.uint8ArrayToBigInt = (array) => {
|
13
|
-
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
14
|
-
if (typeof view.getBigUint64 === 'function') {
|
15
|
-
return view.getBigUint64(0);
|
16
|
-
}
|
17
|
-
else {
|
18
|
-
const high = BigInt(view.getUint32(0));
|
19
|
-
const low = BigInt(view.getUint32(4));
|
20
|
-
return (high << BigInt(32)) + low;
|
21
|
-
}
|
22
|
-
};
|
23
|
-
const TWO_TO_THE_32 = BigInt(1) << BigInt(32);
|
24
|
-
exports.bigIntToUint8Array = (value) => {
|
25
|
-
const array = new Uint8Array(8);
|
26
|
-
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
27
|
-
if (typeof view.setBigUint64 === 'function') {
|
28
|
-
view.setBigUint64(0, value);
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
view.setUint32(0, Number(value >> BigInt(32)));
|
32
|
-
view.setUint32(4, Number(value % TWO_TO_THE_32));
|
33
|
-
}
|
34
|
-
return array;
|
35
|
-
};
|
36
|
-
exports.arrayBufferToArrayOfNumber = (buffer) => {
|
37
|
-
const typedArray = new Uint8Array(buffer);
|
38
|
-
return Array.from(typedArray);
|
39
|
-
};
|
40
|
-
exports.arrayOfNumberToUint8Array = (numbers) => {
|
41
|
-
return new Uint8Array(numbers);
|
42
|
-
};
|
43
|
-
exports.arrayOfNumberToArrayBuffer = (numbers) => {
|
44
|
-
return exports.arrayOfNumberToUint8Array(numbers).buffer;
|
45
|
-
};
|
46
|
-
exports.arrayBufferToNumber = (buffer) => {
|
47
|
-
const view = new DataView(buffer);
|
48
|
-
return view.getUint32(view.byteLength - 4);
|
49
|
-
};
|
50
|
-
exports.numberToArrayBuffer = (value, byteLength) => {
|
51
|
-
const buffer = new ArrayBuffer(byteLength);
|
52
|
-
new DataView(buffer).setUint32(byteLength - 4, value);
|
53
|
-
return buffer;
|
54
|
-
};
|
55
|
-
exports.asciiStringToByteArray = (text) => {
|
56
|
-
return Array.from(text).map(c => c.charCodeAt(0));
|
57
|
-
};
|
58
|
-
exports.toSubAccountId = (subAccount) => {
|
59
|
-
const bytes = exports.arrayOfNumberToArrayBuffer(subAccount);
|
60
|
-
return exports.arrayBufferToNumber(bytes);
|
61
|
-
};
|
62
|
-
exports.fromSubAccountId = (subAccountId) => {
|
63
|
-
const buffer = exports.numberToArrayBuffer(subAccountId, constants_1.SUB_ACCOUNT_BYTE_LENGTH);
|
64
|
-
return exports.arrayBufferToArrayOfNumber(buffer);
|
65
|
-
};
|
66
|
-
exports.accountIdentifierToBytes = (accountIdentifier) => {
|
67
|
-
return Uint8Array.from(buffer_1.Buffer.from(accountIdentifier, 'hex')).subarray(4);
|
68
|
-
};
|
69
|
-
exports.accountIdentifierFromBytes = (accountIdentifier) => {
|
70
|
-
return buffer_1.Buffer.from(accountIdentifier).toString('hex');
|
71
|
-
};
|
72
|
-
exports.principalToAccountIdentifier = (principal, subAccount) => {
|
73
|
-
// Hash (sha224) the principal, the subAccount and some padding
|
74
|
-
const padding = exports.asciiStringToByteArray('\x0Aaccount-id');
|
75
|
-
const shaObj = js_sha256_1.sha224.create();
|
76
|
-
shaObj.update([...padding, ...principal.toUint8Array(), ...(subAccount !== null && subAccount !== void 0 ? subAccount : Array(32).fill(0))]);
|
77
|
-
const hash = new Uint8Array(shaObj.array());
|
78
|
-
// Prepend the checksum of the hash and convert to a hex string
|
79
|
-
const checksum = exports.calculateCrc32(hash);
|
80
|
-
const bytes = new Uint8Array([...checksum, ...hash]);
|
81
|
-
return toHexString(bytes);
|
82
|
-
};
|
83
|
-
exports.principalToSubAccount = (principal) => {
|
84
|
-
const bytes = principal.toUint8Array();
|
85
|
-
const subAccount = new Uint8Array(32);
|
86
|
-
subAccount[0] = bytes.length;
|
87
|
-
subAccount.set(bytes, 1);
|
88
|
-
return subAccount;
|
89
|
-
};
|
90
|
-
exports.stringToAccountIdentifier = (str) => {
|
91
|
-
try {
|
92
|
-
if (str.length === 64) {
|
93
|
-
return str;
|
94
|
-
}
|
95
|
-
if (str.length === 63) {
|
96
|
-
return exports.principalToAccountIdentifier(principal_1.Principal.fromText(str));
|
97
|
-
}
|
98
|
-
return undefined;
|
99
|
-
}
|
100
|
-
catch (error) {
|
101
|
-
return undefined;
|
102
|
-
}
|
103
|
-
};
|
104
|
-
const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
|
105
|
-
// 4 bytes
|
106
|
-
exports.calculateCrc32 = (bytes) => {
|
107
|
-
const checksumArrayBuf = new ArrayBuffer(4);
|
108
|
-
const view = new DataView(checksumArrayBuf);
|
109
|
-
view.setUint32(0, crc_1.default.crc32(buffer_1.Buffer.from(bytes)), false);
|
110
|
-
return buffer_1.Buffer.from(checksumArrayBuf);
|
111
|
-
};
|
112
|
-
exports.E8S_PER_ICP = 100000000;
|
113
|
-
var TokenSymbol;
|
114
|
-
(function (TokenSymbol) {
|
115
|
-
TokenSymbol["ICP"] = "ICP";
|
116
|
-
})(TokenSymbol = exports.TokenSymbol || (exports.TokenSymbol = {}));
|
117
|
-
exports.formatAssetBySymbol = (_amount, symbol) => {
|
118
|
-
const amount = parseInt(_amount === null || _amount === void 0 ? void 0 : _amount.toString(), 10);
|
119
|
-
const tokenMap = [
|
120
|
-
{
|
121
|
-
ICP: {
|
122
|
-
amount: amount / exports.E8S_PER_ICP,
|
123
|
-
symbol: 'ICP',
|
124
|
-
},
|
125
|
-
},
|
126
|
-
];
|
127
|
-
const found = tokenMap.find(v => v[symbol] !== undefined);
|
128
|
-
return found === null || found === void 0 ? void 0 : found[symbol];
|
129
|
-
};
|
130
|
-
//# sourceMappingURL=converter.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../../../src/utils/converter.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA+C;AAC/C,yCAAmC;AACnC,mCAAgC;AAChC,8CAAsB;AACtB,2CAAsD;AAGzC,QAA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,CAAC,CAAC;IAC5C,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,aAAG,CAAC,KAAK,CAAC,eAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACxD,OAAO,eAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACvC,CAAC,CAAC;AAEW,QAAA,WAAW,GAAG,SAAW,CAAC;AAEvC,IAAY,WAEX;AAFD,WAAY,WAAW;IACrB,0BAAW,CAAA;AACb,CAAC,EAFW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAEtB;AAMY,QAAA,mBAAmB,GAAG,CACjC,OAAe,EACf,MAAc,EACkC,EAAE;IAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAmB;QAC/B;YACE,GAAG,EAAE;gBACH,MAAM,EAAE,MAAM,GAAG,mBAAW;gBAC5B,MAAM,EAAE,KAAK;aACd;SACF;KACF,CAAC;IACF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC;IAC1D,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,MAAM,EAAE;AACzB,CAAC,CAAC"}
|
package/lib/cjs/utils/index.d.ts
DELETED
package/lib/cjs/utils/index.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
11
|
-
};
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
-
__exportStar(require("./common/types"), exports);
|
14
|
-
__exportStar(require("./constants"), exports);
|
15
|
-
__exportStar(require("./converter"), exports);
|
16
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,8CAA4B"}
|
@@ -1,98 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
2
|
-
export default ({ IDL }) => {
|
3
|
-
const InternetIdentityInit = IDL.Record({
|
4
|
-
assigned_user_number_range: IDL.Tuple(IDL.Nat64, IDL.Nat64),
|
5
|
-
});
|
6
|
-
const UserNumber = IDL.Nat64;
|
7
|
-
const PublicKey = IDL.Vec(IDL.Nat8);
|
8
|
-
const DeviceKey = PublicKey;
|
9
|
-
const KeyType = IDL.Variant({
|
10
|
-
platform: IDL.Null,
|
11
|
-
seed_phrase: IDL.Null,
|
12
|
-
cross_platform: IDL.Null,
|
13
|
-
unknown: IDL.Null,
|
14
|
-
});
|
15
|
-
const Purpose = IDL.Variant({
|
16
|
-
authentication: IDL.Null,
|
17
|
-
recovery: IDL.Null,
|
18
|
-
});
|
19
|
-
const CredentialId = IDL.Vec(IDL.Nat8);
|
20
|
-
const DeviceData = IDL.Record({
|
21
|
-
alias: IDL.Text,
|
22
|
-
pubkey: DeviceKey,
|
23
|
-
key_type: KeyType,
|
24
|
-
purpose: Purpose,
|
25
|
-
credential_id: IDL.Opt(CredentialId),
|
26
|
-
});
|
27
|
-
const FrontendHostname = IDL.Text;
|
28
|
-
const SessionKey = PublicKey;
|
29
|
-
const Timestamp = IDL.Nat64;
|
30
|
-
const Delegation = IDL.Record({
|
31
|
-
pubkey: PublicKey,
|
32
|
-
targets: IDL.Opt(IDL.Vec(IDL.Principal)),
|
33
|
-
expiration: Timestamp,
|
34
|
-
});
|
35
|
-
const SignedDelegation = IDL.Record({
|
36
|
-
signature: IDL.Vec(IDL.Nat8),
|
37
|
-
delegation: Delegation,
|
38
|
-
});
|
39
|
-
const GetDelegationResponse = IDL.Variant({
|
40
|
-
no_such_delegation: IDL.Null,
|
41
|
-
signed_delegation: SignedDelegation,
|
42
|
-
});
|
43
|
-
const HeaderField = IDL.Tuple(IDL.Text, IDL.Text);
|
44
|
-
const HttpRequest = IDL.Record({
|
45
|
-
url: IDL.Text,
|
46
|
-
method: IDL.Text,
|
47
|
-
body: IDL.Vec(IDL.Nat8),
|
48
|
-
headers: IDL.Vec(HeaderField),
|
49
|
-
});
|
50
|
-
const Token = IDL.Record({});
|
51
|
-
const StreamingCallbackHttpResponse = IDL.Record({
|
52
|
-
token: IDL.Opt(Token),
|
53
|
-
body: IDL.Vec(IDL.Nat8),
|
54
|
-
});
|
55
|
-
const StreamingStrategy = IDL.Variant({
|
56
|
-
Callback: IDL.Record({
|
57
|
-
token: Token,
|
58
|
-
callback: IDL.Func([Token], [StreamingCallbackHttpResponse], ['query']),
|
59
|
-
}),
|
60
|
-
});
|
61
|
-
const HttpResponse = IDL.Record({
|
62
|
-
body: IDL.Vec(IDL.Nat8),
|
63
|
-
headers: IDL.Vec(HeaderField),
|
64
|
-
streaming_strategy: IDL.Opt(StreamingStrategy),
|
65
|
-
status_code: IDL.Nat16,
|
66
|
-
});
|
67
|
-
const UserKey = PublicKey;
|
68
|
-
const ProofOfWork = IDL.Record({
|
69
|
-
nonce: IDL.Nat64,
|
70
|
-
timestamp: Timestamp,
|
71
|
-
});
|
72
|
-
const RegisterResponse = IDL.Variant({
|
73
|
-
canister_full: IDL.Null,
|
74
|
-
registered: IDL.Record({ user_number: UserNumber }),
|
75
|
-
});
|
76
|
-
const InternetIdentityStats = IDL.Record({
|
77
|
-
users_registered: IDL.Nat64,
|
78
|
-
assigned_user_number_range: IDL.Tuple(IDL.Nat64, IDL.Nat64),
|
79
|
-
});
|
80
|
-
return IDL.Service({
|
81
|
-
add: IDL.Func([UserNumber, DeviceData], [], []),
|
82
|
-
get_delegation: IDL.Func([UserNumber, FrontendHostname, SessionKey, Timestamp], [GetDelegationResponse], ['query']),
|
83
|
-
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
84
|
-
init_salt: IDL.Func([], [], []),
|
85
|
-
lookup: IDL.Func([UserNumber], [IDL.Vec(DeviceData)], ['query']),
|
86
|
-
prepare_delegation: IDL.Func([UserNumber, FrontendHostname, SessionKey, IDL.Opt(IDL.Nat64)], [UserKey, Timestamp], []),
|
87
|
-
register: IDL.Func([DeviceData, ProofOfWork], [RegisterResponse], []),
|
88
|
-
remove: IDL.Func([UserNumber, DeviceKey], [], []),
|
89
|
-
stats: IDL.Func([], [InternetIdentityStats], ['query']),
|
90
|
-
});
|
91
|
-
};
|
92
|
-
export const init = ({ IDL }) => {
|
93
|
-
const InternetIdentityInit = IDL.Record({
|
94
|
-
assigned_user_number_range: IDL.Tuple(IDL.Nat64, IDL.Nat64),
|
95
|
-
});
|
96
|
-
return [IDL.Opt(InternetIdentityInit)];
|
97
|
-
};
|
98
|
-
//# sourceMappingURL=internet_identity_idl.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"internet_identity_idl.js","sourceRoot":"","sources":["../../../src/canisters/internet_identity_idl.js"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,eAAe,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACzB,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,CAAC;QACtC,0BAA0B,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;KAC5D,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC;IAC7B,M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CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;QAChE,kBAAkB,EAAE,GAAG,CAAC,IAAI,CAC1B,CAAC,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAC9D,CAAC,OAAO,EAAE,SAAS,CAAC,EACpB,EAAE,CACH;QACD,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;QACrE,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;QACjD,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;KACxD,CAAC,CAAC;AACL,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IAC9B,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,CAAC;QACtC,0BAA0B,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;KAC5D,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC"}
|
@@ -1,78 +0,0 @@
|
|
1
|
-
export default ({ IDL }) => {
|
2
|
-
const AccountIdentifier = IDL.Text;
|
3
|
-
const Duration = IDL.Record({ secs: IDL.Nat64, nanos: IDL.Nat32 });
|
4
|
-
const ArchiveOptions = IDL.Record({
|
5
|
-
max_message_size_bytes: IDL.Opt(IDL.Nat32),
|
6
|
-
node_max_memory_size_bytes: IDL.Opt(IDL.Nat32),
|
7
|
-
controller_id: IDL.Principal,
|
8
|
-
});
|
9
|
-
const ICPTs = IDL.Record({ e8s: IDL.Nat64 });
|
10
|
-
const LedgerCanisterInitPayload = IDL.Record({
|
11
|
-
send_whitelist: IDL.Vec(IDL.Tuple(IDL.Principal)),
|
12
|
-
minting_account: AccountIdentifier,
|
13
|
-
transaction_window: IDL.Opt(Duration),
|
14
|
-
max_message_size_bytes: IDL.Opt(IDL.Nat32),
|
15
|
-
archive_options: IDL.Opt(ArchiveOptions),
|
16
|
-
initial_values: IDL.Vec(IDL.Tuple(AccountIdentifier, ICPTs)),
|
17
|
-
});
|
18
|
-
const AccountBalanceArgs = IDL.Record({ account: AccountIdentifier });
|
19
|
-
const CanisterId = IDL.Principal;
|
20
|
-
const HeaderField = IDL.Tuple(IDL.Text, IDL.Text);
|
21
|
-
const HttpRequest = IDL.Record({
|
22
|
-
url: IDL.Text,
|
23
|
-
method: IDL.Text,
|
24
|
-
body: IDL.Vec(IDL.Nat8),
|
25
|
-
headers: IDL.Vec(HeaderField),
|
26
|
-
});
|
27
|
-
const HttpResponse = IDL.Record({
|
28
|
-
body: IDL.Vec(IDL.Nat8),
|
29
|
-
headers: IDL.Vec(HeaderField),
|
30
|
-
status_code: IDL.Nat16,
|
31
|
-
});
|
32
|
-
const SubAccount = IDL.Vec(IDL.Nat8);
|
33
|
-
const BlockHeight = IDL.Nat64;
|
34
|
-
const NotifyCanisterArgs = IDL.Record({
|
35
|
-
to_subaccount: IDL.Opt(SubAccount),
|
36
|
-
from_subaccount: IDL.Opt(SubAccount),
|
37
|
-
to_canister: IDL.Principal,
|
38
|
-
max_fee: ICPTs,
|
39
|
-
block_height: BlockHeight,
|
40
|
-
});
|
41
|
-
const Memo = IDL.Nat64;
|
42
|
-
const TimeStamp = IDL.Record({ timestamp_nanos: IDL.Nat64 });
|
43
|
-
const SendArgs = IDL.Record({
|
44
|
-
to: AccountIdentifier,
|
45
|
-
fee: ICPTs,
|
46
|
-
memo: Memo,
|
47
|
-
from_subaccount: IDL.Opt(SubAccount),
|
48
|
-
created_at_time: IDL.Opt(TimeStamp),
|
49
|
-
amount: ICPTs,
|
50
|
-
});
|
51
|
-
return IDL.Service({
|
52
|
-
account_balance_dfx: IDL.Func([AccountBalanceArgs], [ICPTs], ['query']),
|
53
|
-
get_nodes: IDL.Func([], [IDL.Vec(CanisterId)], ['query']),
|
54
|
-
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
55
|
-
notify_dfx: IDL.Func([NotifyCanisterArgs], [], []),
|
56
|
-
send_dfx: IDL.Func([SendArgs], [BlockHeight], []),
|
57
|
-
});
|
58
|
-
};
|
59
|
-
export const init = ({ IDL }) => {
|
60
|
-
const AccountIdentifier = IDL.Text;
|
61
|
-
const Duration = IDL.Record({ secs: IDL.Nat64, nanos: IDL.Nat32 });
|
62
|
-
const ArchiveOptions = IDL.Record({
|
63
|
-
max_message_size_bytes: IDL.Opt(IDL.Nat32),
|
64
|
-
node_max_memory_size_bytes: IDL.Opt(IDL.Nat32),
|
65
|
-
controller_id: IDL.Principal,
|
66
|
-
});
|
67
|
-
const ICPTs = IDL.Record({ e8s: IDL.Nat64 });
|
68
|
-
const LedgerCanisterInitPayload = IDL.Record({
|
69
|
-
send_whitelist: IDL.Vec(IDL.Tuple(IDL.Principal)),
|
70
|
-
minting_account: AccountIdentifier,
|
71
|
-
transaction_window: IDL.Opt(Duration),
|
72
|
-
max_message_size_bytes: IDL.Opt(IDL.Nat32),
|
73
|
-
archive_options: IDL.Opt(ArchiveOptions),
|
74
|
-
initial_values: IDL.Vec(IDL.Tuple(AccountIdentifier, ICPTs)),
|
75
|
-
});
|
76
|
-
return [LedgerCanisterInitPayload];
|
77
|
-
};
|
78
|
-
//# sourceMappingURL=ledger.idl.js.map
|