@astrox/connection 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/lib/cjs/canisters/internet_identity_idl.d.ts +7 -0
- package/lib/cjs/canisters/internet_identity_idl.js +101 -0
- package/lib/cjs/canisters/internet_identity_idl.js.map +1 -0
- package/lib/cjs/canisters/ledger.idl.d.ts +7 -0
- package/lib/cjs/canisters/ledger.idl.js +81 -0
- package/lib/cjs/canisters/ledger.idl.js.map +1 -0
- package/lib/cjs/canisters/me.idl.d.ts +7 -0
- package/lib/cjs/canisters/me.idl.js +125 -0
- package/lib/cjs/canisters/me.idl.js.map +1 -0
- package/lib/cjs/canisters/nns-dapp-cert.idl.d.ts +7 -0
- package/lib/cjs/canisters/nns-dapp-cert.idl.js +86 -0
- package/lib/cjs/canisters/nns-dapp-cert.idl.js.map +1 -0
- package/lib/cjs/canisters/nns-dapp.idl.d.ts +7 -0
- package/lib/cjs/canisters/nns-dapp.idl.js +184 -0
- package/lib/cjs/canisters/nns-dapp.idl.js.map +1 -0
- package/lib/cjs/connections/baseConnection.d.ts +52 -0
- package/lib/cjs/connections/baseConnection.js +87 -0
- package/lib/cjs/connections/baseConnection.js.map +1 -0
- package/lib/cjs/connections/ledgerConnection.d.ts +57 -0
- package/lib/cjs/connections/ledgerConnection.js +135 -0
- package/lib/cjs/connections/ledgerConnection.js.map +1 -0
- package/lib/cjs/connections/nnsConnection.d.ts +62 -0
- package/lib/cjs/connections/nnsConnection.js +166 -0
- package/lib/cjs/connections/nnsConnection.js.map +1 -0
- package/lib/cjs/ic/icAuthClient.d.ts +31 -0
- package/lib/cjs/ic/icAuthClient.js +233 -0
- package/lib/cjs/ic/icAuthClient.js.map +1 -0
- package/lib/cjs/ic/icConnect.d.ts +32 -0
- package/lib/cjs/ic/icConnect.js +181 -0
- package/lib/cjs/ic/icConnect.js.map +1 -0
- package/lib/cjs/ic/icStorage.d.ts +16 -0
- package/lib/cjs/ic/icStorage.js +49 -0
- package/lib/cjs/ic/icStorage.js.map +1 -0
- package/lib/cjs/ic/icWindow.d.ts +7 -0
- package/lib/cjs/ic/icWindow.js +20 -0
- package/lib/cjs/ic/icWindow.js.map +1 -0
- package/lib/cjs/ic/index.d.ts +2 -0
- package/lib/cjs/ic/index.js +7 -0
- package/lib/cjs/ic/index.js.map +1 -0
- package/lib/cjs/ic/types.d.ts +129 -0
- package/lib/cjs/ic/types.js +17 -0
- package/lib/cjs/ic/types.js.map +1 -0
- package/lib/cjs/index.d.ts +5 -0
- package/lib/cjs/index.js +18 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/utils/common/types.d.ts +15 -0
- package/lib/cjs/utils/common/types.js +12 -0
- package/lib/cjs/utils/common/types.js.map +1 -0
- package/lib/cjs/utils/constants.d.ts +6 -0
- package/lib/cjs/utils/constants.js +13 -0
- package/lib/cjs/utils/constants.js.map +1 -0
- package/lib/cjs/utils/converter.d.ts +32 -0
- package/lib/cjs/utils/converter.js +130 -0
- package/lib/cjs/utils/converter.js.map +1 -0
- package/lib/cjs/utils/index.d.ts +3 -0
- package/lib/cjs/utils/index.js +16 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/esm/canisters/internet_identity_idl.d.ts +7 -0
- package/lib/esm/canisters/internet_identity_idl.js +98 -0
- package/lib/esm/canisters/internet_identity_idl.js.map +1 -0
- package/lib/esm/canisters/ledger.idl.d.ts +7 -0
- package/lib/esm/canisters/ledger.idl.js +78 -0
- package/lib/esm/canisters/ledger.idl.js.map +1 -0
- package/lib/esm/canisters/me.idl.d.ts +7 -0
- package/lib/esm/canisters/me.idl.js +122 -0
- package/lib/esm/canisters/me.idl.js.map +1 -0
- package/lib/esm/canisters/nns-dapp-cert.idl.d.ts +7 -0
- package/lib/esm/canisters/nns-dapp-cert.idl.js +83 -0
- package/lib/esm/canisters/nns-dapp-cert.idl.js.map +1 -0
- package/lib/esm/canisters/nns-dapp.idl.d.ts +7 -0
- package/lib/esm/canisters/nns-dapp.idl.js +181 -0
- package/lib/esm/canisters/nns-dapp.idl.js.map +1 -0
- package/lib/esm/connections/baseConnection.d.ts +52 -0
- package/lib/esm/connections/baseConnection.js +80 -0
- package/lib/esm/connections/baseConnection.js.map +1 -0
- package/lib/esm/connections/ledgerConnection.d.ts +57 -0
- package/lib/esm/connections/ledgerConnection.js +128 -0
- package/lib/esm/connections/ledgerConnection.js.map +1 -0
- package/lib/esm/connections/nnsConnection.d.ts +62 -0
- package/lib/esm/connections/nnsConnection.js +159 -0
- package/lib/esm/connections/nnsConnection.js.map +1 -0
- package/lib/esm/ic/icAuthClient.d.ts +31 -0
- package/lib/esm/ic/icAuthClient.js +229 -0
- package/lib/esm/ic/icAuthClient.js.map +1 -0
- package/lib/esm/ic/icConnect.d.ts +32 -0
- package/lib/esm/ic/icConnect.js +177 -0
- package/lib/esm/ic/icConnect.js.map +1 -0
- package/lib/esm/ic/icStorage.d.ts +16 -0
- package/lib/esm/ic/icStorage.js +44 -0
- package/lib/esm/ic/icStorage.js.map +1 -0
- package/lib/esm/ic/icWindow.d.ts +7 -0
- package/lib/esm/ic/icWindow.js +16 -0
- package/lib/esm/ic/icWindow.js.map +1 -0
- package/lib/esm/ic/index.d.ts +2 -0
- package/lib/esm/ic/index.js +3 -0
- package/lib/esm/ic/index.js.map +1 -0
- package/lib/esm/ic/types.d.ts +129 -0
- package/lib/esm/ic/types.js +14 -0
- package/lib/esm/ic/types.js.map +1 -0
- package/lib/esm/index.d.ts +5 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/utils/common/types.d.ts +15 -0
- package/lib/esm/utils/common/types.js +9 -0
- package/lib/esm/utils/common/types.js.map +1 -0
- package/lib/esm/utils/constants.d.ts +6 -0
- package/lib/esm/utils/constants.js +10 -0
- package/lib/esm/utils/constants.js.map +1 -0
- package/lib/esm/utils/converter.d.ts +32 -0
- package/lib/esm/utils/converter.js +124 -0
- package/lib/esm/utils/converter.js.map +1 -0
- package/lib/esm/utils/index.d.ts +3 -0
- package/lib/esm/utils/index.js +4 -0
- package/lib/esm/utils/index.js.map +1 -0
- package/lib/tsconfig-cjs.tsbuildinfo +2834 -0
- package/lib/tsconfig.tsbuildinfo +2833 -0
- package/package.json +53 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
import { AuthClientStorage } from './types';
|
2
|
+
export declare const KEY_SESSIONSTORAGE_KEY = "identity";
|
3
|
+
export declare const KEY_SESSIONSTORAGE_DELEGATION = "delegation";
|
4
|
+
export declare const KEY_SESSIONSTORAGE_WALLET = "wallet";
|
5
|
+
export declare const IDENTITY_PROVIDER_DEFAULT = "https://identity.ic0.app";
|
6
|
+
export declare const IDENTITY_PROVIDER_ENDPOINT = "#authorize";
|
7
|
+
export declare function _deleteStorage(storage: AuthClientStorage): Promise<void>;
|
8
|
+
export declare class SessionStorage implements AuthClientStorage {
|
9
|
+
readonly prefix: string;
|
10
|
+
private readonly _sessionStorage?;
|
11
|
+
constructor(prefix?: string, _sessionStorage?: Storage | undefined);
|
12
|
+
get(key: string): Promise<string | null>;
|
13
|
+
set(key: string, value: string): Promise<void>;
|
14
|
+
remove(key: string): Promise<void>;
|
15
|
+
private _getSessionStorage;
|
16
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
export const KEY_SESSIONSTORAGE_KEY = 'identity';
|
2
|
+
export const KEY_SESSIONSTORAGE_DELEGATION = 'delegation';
|
3
|
+
export const KEY_SESSIONSTORAGE_WALLET = 'wallet';
|
4
|
+
export const IDENTITY_PROVIDER_DEFAULT = 'https://identity.ic0.app';
|
5
|
+
export const IDENTITY_PROVIDER_ENDPOINT = '#authorize';
|
6
|
+
export async function _deleteStorage(storage) {
|
7
|
+
await storage.remove(KEY_SESSIONSTORAGE_KEY);
|
8
|
+
await storage.remove(KEY_SESSIONSTORAGE_DELEGATION);
|
9
|
+
await storage.remove(KEY_SESSIONSTORAGE_WALLET);
|
10
|
+
}
|
11
|
+
export class SessionStorage {
|
12
|
+
constructor(prefix = 'ic-', _sessionStorage) {
|
13
|
+
this.prefix = prefix;
|
14
|
+
this._sessionStorage = _sessionStorage;
|
15
|
+
}
|
16
|
+
get(key) {
|
17
|
+
return Promise.resolve(this._getSessionStorage().getItem(this.prefix + key));
|
18
|
+
}
|
19
|
+
set(key, value) {
|
20
|
+
this._getSessionStorage().setItem(this.prefix + key, value);
|
21
|
+
return Promise.resolve();
|
22
|
+
}
|
23
|
+
remove(key) {
|
24
|
+
this._getSessionStorage().removeItem(this.prefix + key);
|
25
|
+
return Promise.resolve();
|
26
|
+
}
|
27
|
+
_getSessionStorage() {
|
28
|
+
if (this._sessionStorage) {
|
29
|
+
return this._sessionStorage;
|
30
|
+
}
|
31
|
+
const ls = typeof window === 'undefined'
|
32
|
+
? typeof global === 'undefined'
|
33
|
+
? typeof self === 'undefined'
|
34
|
+
? undefined
|
35
|
+
: self.sessionStorage
|
36
|
+
: global.sessionStorage
|
37
|
+
: window.sessionStorage;
|
38
|
+
if (!ls) {
|
39
|
+
throw new Error('Could not find local storage.');
|
40
|
+
}
|
41
|
+
return ls;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=icStorage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"icStorage.js","sourceRoot":"","sources":["../../../src/ic/icStorage.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AACjD,MAAM,CAAC,MAAM,6BAA6B,GAAG,YAAY,CAAC;AAC1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAClD,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AACpE,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA0B;IAC7D,MAAM,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAC7C,MAAM,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC;IAC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;CACF"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { EventHandler } from './types';
|
2
|
+
export declare class ICWindow {
|
3
|
+
protected _window?: Window;
|
4
|
+
protected _eventHandler?: EventHandler;
|
5
|
+
protected _removeEventListener(): void;
|
6
|
+
protected _openWindow(url: string, target?: string, feature?: string): void;
|
7
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export class ICWindow {
|
2
|
+
_removeEventListener() {
|
3
|
+
if (this._eventHandler) {
|
4
|
+
window.removeEventListener('message', this._eventHandler);
|
5
|
+
}
|
6
|
+
this._eventHandler = undefined;
|
7
|
+
}
|
8
|
+
_openWindow(url, target, feature) {
|
9
|
+
var _a, _b;
|
10
|
+
(_a = this._window) === null || _a === void 0 ? void 0 : _a.close();
|
11
|
+
this._removeEventListener();
|
12
|
+
// Open a new window with the IDP provider.
|
13
|
+
this._window = (_b = window.open(url, target !== null && target !== void 0 ? target : 'icWindow', feature)) !== null && _b !== void 0 ? _b : undefined;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=icWindow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"icWindow.js","sourceRoot":"","sources":["../../../src/ic/icWindow.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,QAAQ;IAIT,oBAAoB;QAC5B,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAC3D;QACD,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;IACjC,CAAC;IAES,WAAW,CAAC,GAAW,EAAE,MAAe,EAAE,OAAgB;;QAClE,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,GAAG;QACtB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,2CAA2C;QAC3C,IAAI,CAAC,OAAO,SAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,UAAU,EAAE,OAAO,CAAC,mCAAI,SAAS,CAAC;IAC9E,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC"}
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import { SignIdentity } from '@dfinity/agent';
|
2
|
+
import { Principal } from '@dfinity/principal';
|
3
|
+
import { IC } from './icConnect';
|
4
|
+
import { AccountIdentifier } from '../utils/common/types';
|
5
|
+
import { SendOpts } from '../connections/ledgerConnection';
|
6
|
+
/**
|
7
|
+
* List of options for creating an {@link AuthClient}.
|
8
|
+
*/
|
9
|
+
export interface AuthClientCreateOptions {
|
10
|
+
/**
|
11
|
+
* An identity to use as the base
|
12
|
+
*/
|
13
|
+
identity?: SignIdentity;
|
14
|
+
/**
|
15
|
+
* Optional storage with get, set, and remove. Uses SessionStorage by default
|
16
|
+
*/
|
17
|
+
storage?: AuthClientStorage;
|
18
|
+
appId?: string;
|
19
|
+
idpWindowOption?: string;
|
20
|
+
}
|
21
|
+
export interface AuthClientLoginOptions extends AuthClientCreateOptions {
|
22
|
+
/**
|
23
|
+
* Identity provider. By default, use the identity service.
|
24
|
+
*/
|
25
|
+
identityProvider?: string | URL;
|
26
|
+
permissions?: PermissionsType[];
|
27
|
+
/**
|
28
|
+
* Experiation of the authentication
|
29
|
+
*/
|
30
|
+
maxTimeToLive?: bigint;
|
31
|
+
/**
|
32
|
+
* Callback once login has completed
|
33
|
+
*/
|
34
|
+
onSuccess?: () => void | Promise<void>;
|
35
|
+
/**
|
36
|
+
* Callback in case authentication fails
|
37
|
+
*/
|
38
|
+
onError?: (error?: string) => void;
|
39
|
+
/**
|
40
|
+
* Callback once is authenticated
|
41
|
+
*/
|
42
|
+
onAuthenticated?: (ic: IC) => void | Promise<void>;
|
43
|
+
}
|
44
|
+
export interface TransactionOptions {
|
45
|
+
/**
|
46
|
+
* Identity provider. By default, use the identity service.
|
47
|
+
*/
|
48
|
+
walletProvider?: string | URL;
|
49
|
+
from: AccountIdentifier;
|
50
|
+
to: AccountIdentifier;
|
51
|
+
amount: bigint;
|
52
|
+
sendOpts: SendOpts;
|
53
|
+
/**
|
54
|
+
* Callback once login has completed
|
55
|
+
*/
|
56
|
+
onSuccess?: () => void | Promise<void>;
|
57
|
+
/**
|
58
|
+
* Callback in case authentication fails
|
59
|
+
*/
|
60
|
+
onError?: (error?: string) => void;
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* Interface for persisting user authentication data
|
64
|
+
*/
|
65
|
+
export interface AuthClientStorage {
|
66
|
+
get(key: string): Promise<string | null>;
|
67
|
+
set(key: string, value: string): Promise<void>;
|
68
|
+
remove(key: string): Promise<void>;
|
69
|
+
}
|
70
|
+
export interface InternetIdentityAuthRequest {
|
71
|
+
kind: 'authorize-client';
|
72
|
+
sessionPublicKey: Uint8Array;
|
73
|
+
permissions?: PermissionsType[];
|
74
|
+
maxTimeToLive?: bigint;
|
75
|
+
appId?: string;
|
76
|
+
}
|
77
|
+
export interface DelegationResult {
|
78
|
+
delegations: {
|
79
|
+
delegation: {
|
80
|
+
pubkey: Uint8Array;
|
81
|
+
expiration: bigint;
|
82
|
+
targets?: Principal[];
|
83
|
+
};
|
84
|
+
signature: Uint8Array;
|
85
|
+
}[];
|
86
|
+
userPublicKey: Uint8Array;
|
87
|
+
}
|
88
|
+
export interface MeAuthResponseSuccess {
|
89
|
+
kind: 'authorize-client-success';
|
90
|
+
identity: DelegationResult;
|
91
|
+
wallet?: string;
|
92
|
+
}
|
93
|
+
export interface IIAuthResponseSuccess extends DelegationResult {
|
94
|
+
kind: 'authorize-client-success';
|
95
|
+
}
|
96
|
+
export declare type AuthResponseSuccess = MeAuthResponseSuccess | IIAuthResponseSuccess;
|
97
|
+
export declare type EventHandler = (event: MessageEvent) => Promise<void>;
|
98
|
+
export declare enum PermissionsType {
|
99
|
+
identity = "permissions-identity",
|
100
|
+
wallet = "permissions-wallet"
|
101
|
+
}
|
102
|
+
export declare type ConnectOptions = AuthClientLoginOptions;
|
103
|
+
export declare enum TransactionMessageKind {
|
104
|
+
client = "transaction-client",
|
105
|
+
ready = "transaction-ready",
|
106
|
+
success = "transaction-client-success",
|
107
|
+
fail = "transaction-client-failure"
|
108
|
+
}
|
109
|
+
export interface TransactionReadyMessage {
|
110
|
+
kind: TransactionMessageKind.ready;
|
111
|
+
}
|
112
|
+
export interface TransactionResponseFailure {
|
113
|
+
kind: TransactionMessageKind.fail;
|
114
|
+
text: string;
|
115
|
+
}
|
116
|
+
export interface TransactionResponseSuccess {
|
117
|
+
kind: TransactionMessageKind.success;
|
118
|
+
}
|
119
|
+
export declare type TransactionResponseMessage = TransactionReadyMessage | TransactionResponse;
|
120
|
+
export declare type TransactionResponse = TransactionResponseSuccess | TransactionResponseFailure;
|
121
|
+
export interface AuthReadyMessage {
|
122
|
+
kind: 'authorize-ready';
|
123
|
+
}
|
124
|
+
export interface AuthResponseFailure {
|
125
|
+
kind: 'authorize-client-failure';
|
126
|
+
text: string;
|
127
|
+
}
|
128
|
+
export declare type IdentityServiceResponseMessage = AuthReadyMessage | AuthResponse;
|
129
|
+
export declare type AuthResponse = AuthResponseSuccess | AuthResponseFailure;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export var PermissionsType;
|
2
|
+
(function (PermissionsType) {
|
3
|
+
PermissionsType["identity"] = "permissions-identity";
|
4
|
+
PermissionsType["wallet"] = "permissions-wallet";
|
5
|
+
})(PermissionsType || (PermissionsType = {}));
|
6
|
+
// Transaction Types
|
7
|
+
export var TransactionMessageKind;
|
8
|
+
(function (TransactionMessageKind) {
|
9
|
+
TransactionMessageKind["client"] = "transaction-client";
|
10
|
+
TransactionMessageKind["ready"] = "transaction-ready";
|
11
|
+
TransactionMessageKind["success"] = "transaction-client-success";
|
12
|
+
TransactionMessageKind["fail"] = "transaction-client-failure";
|
13
|
+
})(TransactionMessageKind || (TransactionMessageKind = {}));
|
14
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ic/types.ts"],"names":[],"mappings":"AAkHA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oDAAiC,CAAA;IACjC,gDAA6B,CAAA;AAC/B,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAID,oBAAoB;AACpB,MAAM,CAAN,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,uDAA6B,CAAA;IAC7B,qDAA2B,CAAA;IAC3B,gEAAsC,CAAA;IACtC,6DAAmC,CAAA;AACrC,CAAC,EALW,sBAAsB,KAAtB,sBAAsB,QAKjC"}
|
package/lib/esm/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
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
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export var WalletType;
|
2
|
+
(function (WalletType) {
|
3
|
+
WalletType["nns"] = "nns";
|
4
|
+
WalletType["plug"] = "plug";
|
5
|
+
WalletType["stoic"] = "stoic";
|
6
|
+
WalletType["me"] = "me";
|
7
|
+
WalletType["unknown"] = "unknown";
|
8
|
+
})(WalletType || (WalletType = {}));
|
9
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/utils/common/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,uBAAS,CAAA;IACT,iCAAmB,CAAA;AACrB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB"}
|
@@ -0,0 +1,6 @@
|
|
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";
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export const SUB_ACCOUNT_BYTE_LENGTH = 32;
|
2
|
+
export const CREATE_CANISTER_MEMO = BigInt(0x41455243); // CREA,
|
3
|
+
export const TOP_UP_CANISTER_MEMO = BigInt(0x50555054); // TPUP
|
4
|
+
export const TRANSACTION_FEE = BigInt(10000);
|
5
|
+
export const LEDGER_CANISTER_ID = 'ryjl3-tyaaa-aaaaa-aaaba-cai';
|
6
|
+
export const NNS_CANISTER_ID = 'qoctq-giaaa-aaaaa-aaaea-cai';
|
7
|
+
// import config from "../config";
|
8
|
+
// // @ts-ignore
|
9
|
+
// export const HOST = "HOST" in config ? config["HOST"] : undefined;
|
10
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO;AAE/D,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,KAAM,CAAC,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG,6BAA6B,CAAC;AAE7D,kCAAkC;AAElC,gBAAgB;AAChB,qEAAqE"}
|
@@ -0,0 +1,32 @@
|
|
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;
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import { Principal } from '@dfinity/principal';
|
2
|
+
import { sha224 } from 'js-sha256';
|
3
|
+
import { Buffer } from 'buffer';
|
4
|
+
import crc from 'crc';
|
5
|
+
import { SUB_ACCOUNT_BYTE_LENGTH } from './constants';
|
6
|
+
export const uint8ArrayToBigInt = (array) => {
|
7
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
8
|
+
if (typeof view.getBigUint64 === 'function') {
|
9
|
+
return view.getBigUint64(0);
|
10
|
+
}
|
11
|
+
else {
|
12
|
+
const high = BigInt(view.getUint32(0));
|
13
|
+
const low = BigInt(view.getUint32(4));
|
14
|
+
return (high << BigInt(32)) + low;
|
15
|
+
}
|
16
|
+
};
|
17
|
+
const TWO_TO_THE_32 = BigInt(1) << BigInt(32);
|
18
|
+
export const bigIntToUint8Array = (value) => {
|
19
|
+
const array = new Uint8Array(8);
|
20
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
21
|
+
if (typeof view.setBigUint64 === 'function') {
|
22
|
+
view.setBigUint64(0, value);
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
view.setUint32(0, Number(value >> BigInt(32)));
|
26
|
+
view.setUint32(4, Number(value % TWO_TO_THE_32));
|
27
|
+
}
|
28
|
+
return array;
|
29
|
+
};
|
30
|
+
export const arrayBufferToArrayOfNumber = (buffer) => {
|
31
|
+
const typedArray = new Uint8Array(buffer);
|
32
|
+
return Array.from(typedArray);
|
33
|
+
};
|
34
|
+
export const arrayOfNumberToUint8Array = (numbers) => {
|
35
|
+
return new Uint8Array(numbers);
|
36
|
+
};
|
37
|
+
export const arrayOfNumberToArrayBuffer = (numbers) => {
|
38
|
+
return arrayOfNumberToUint8Array(numbers).buffer;
|
39
|
+
};
|
40
|
+
export const arrayBufferToNumber = (buffer) => {
|
41
|
+
const view = new DataView(buffer);
|
42
|
+
return view.getUint32(view.byteLength - 4);
|
43
|
+
};
|
44
|
+
export const numberToArrayBuffer = (value, byteLength) => {
|
45
|
+
const buffer = new ArrayBuffer(byteLength);
|
46
|
+
new DataView(buffer).setUint32(byteLength - 4, value);
|
47
|
+
return buffer;
|
48
|
+
};
|
49
|
+
export const asciiStringToByteArray = (text) => {
|
50
|
+
return Array.from(text).map(c => c.charCodeAt(0));
|
51
|
+
};
|
52
|
+
export const toSubAccountId = (subAccount) => {
|
53
|
+
const bytes = arrayOfNumberToArrayBuffer(subAccount);
|
54
|
+
return arrayBufferToNumber(bytes);
|
55
|
+
};
|
56
|
+
export const fromSubAccountId = (subAccountId) => {
|
57
|
+
const buffer = numberToArrayBuffer(subAccountId, SUB_ACCOUNT_BYTE_LENGTH);
|
58
|
+
return arrayBufferToArrayOfNumber(buffer);
|
59
|
+
};
|
60
|
+
export const accountIdentifierToBytes = (accountIdentifier) => {
|
61
|
+
return Uint8Array.from(Buffer.from(accountIdentifier, 'hex')).subarray(4);
|
62
|
+
};
|
63
|
+
export const accountIdentifierFromBytes = (accountIdentifier) => {
|
64
|
+
return Buffer.from(accountIdentifier).toString('hex');
|
65
|
+
};
|
66
|
+
export const principalToAccountIdentifier = (principal, subAccount) => {
|
67
|
+
// Hash (sha224) the principal, the subAccount and some padding
|
68
|
+
const padding = asciiStringToByteArray('\x0Aaccount-id');
|
69
|
+
const shaObj = sha224.create();
|
70
|
+
shaObj.update([...padding, ...principal.toUint8Array(), ...(subAccount !== null && subAccount !== void 0 ? subAccount : Array(32).fill(0))]);
|
71
|
+
const hash = new Uint8Array(shaObj.array());
|
72
|
+
// Prepend the checksum of the hash and convert to a hex string
|
73
|
+
const checksum = calculateCrc32(hash);
|
74
|
+
const bytes = new Uint8Array([...checksum, ...hash]);
|
75
|
+
return toHexString(bytes);
|
76
|
+
};
|
77
|
+
export const principalToSubAccount = (principal) => {
|
78
|
+
const bytes = principal.toUint8Array();
|
79
|
+
const subAccount = new Uint8Array(32);
|
80
|
+
subAccount[0] = bytes.length;
|
81
|
+
subAccount.set(bytes, 1);
|
82
|
+
return subAccount;
|
83
|
+
};
|
84
|
+
export const stringToAccountIdentifier = (str) => {
|
85
|
+
try {
|
86
|
+
if (str.length === 64) {
|
87
|
+
return str;
|
88
|
+
}
|
89
|
+
if (str.length === 63) {
|
90
|
+
return principalToAccountIdentifier(Principal.fromText(str));
|
91
|
+
}
|
92
|
+
return undefined;
|
93
|
+
}
|
94
|
+
catch (error) {
|
95
|
+
return undefined;
|
96
|
+
}
|
97
|
+
};
|
98
|
+
const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
|
99
|
+
// 4 bytes
|
100
|
+
export const calculateCrc32 = (bytes) => {
|
101
|
+
const checksumArrayBuf = new ArrayBuffer(4);
|
102
|
+
const view = new DataView(checksumArrayBuf);
|
103
|
+
view.setUint32(0, crc.crc32(Buffer.from(bytes)), false);
|
104
|
+
return Buffer.from(checksumArrayBuf);
|
105
|
+
};
|
106
|
+
export const E8S_PER_ICP = 100000000;
|
107
|
+
export var TokenSymbol;
|
108
|
+
(function (TokenSymbol) {
|
109
|
+
TokenSymbol["ICP"] = "ICP";
|
110
|
+
})(TokenSymbol || (TokenSymbol = {}));
|
111
|
+
export const formatAssetBySymbol = (_amount, symbol) => {
|
112
|
+
const amount = parseInt(_amount === null || _amount === void 0 ? void 0 : _amount.toString(), 10);
|
113
|
+
const tokenMap = [
|
114
|
+
{
|
115
|
+
ICP: {
|
116
|
+
amount: amount / E8S_PER_ICP,
|
117
|
+
symbol: 'ICP',
|
118
|
+
},
|
119
|
+
},
|
120
|
+
];
|
121
|
+
const found = tokenMap.find(v => v[symbol] !== undefined);
|
122
|
+
return found === null || found === void 0 ? void 0 : found[symbol];
|
123
|
+
};
|
124
|
+
//# sourceMappingURL=converter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../../../src/utils/converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAiB,EAAU,EAAE;IAC9D,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC5E,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU,EAAE;QAC3C,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;KAC7B;SAAM;QACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,OAAO,CAAC,IAAI,IAAI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