@airgap/icp 0.13.11-beta.4 → 0.13.11-beta.5
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/package.json +1 -1
- package/v1/index.d.ts +2 -3
- package/v1/index.js +1 -4
- package/v1/index.js.map +1 -1
- package/v1/module/ICPModule.d.ts +3 -2
- package/v1/module/ICPModule.js +10 -22
- package/v1/module/ICPModule.js.map +1 -1
- package/v1/protocol/ICPImplementation.d.ts +4 -12
- package/v1/protocol/ICPImplementation.js +55 -87
- package/v1/protocol/ICPImplementation.js.map +1 -1
- package/v1/protocol/ICPProtocol.d.ts +1 -4
- package/v1/protocol/ICPProtocol.js +17 -24
- package/v1/protocol/ICPProtocol.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +0 -16
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/types/ledger.d.ts +1 -0
- package/v1/types/ledger.js +2 -1
- package/v1/types/ledger.js.map +1 -1
- package/v1/types/protocol.d.ts +1 -21
- package/v1/protocol/icrc/CkBTCProtocol.d.ts +0 -16
- package/v1/protocol/icrc/CkBTCProtocol.js +0 -366
- package/v1/protocol/icrc/CkBTCProtocol.js.map +0 -1
- package/v1/protocol/icrc/ICRC1Protocol.d.ts +0 -93
- package/v1/protocol/icrc/ICRC1Protocol.js +0 -684
- package/v1/protocol/icrc/ICRC1Protocol.js.map +0 -1
- package/v1/types/ckbtc/metadata.d.ts +0 -4
- package/v1/types/ckbtc/metadata.js +0 -3
- package/v1/types/ckbtc/metadata.js.map +0 -1
- package/v1/types/icrc/account.d.ts +0 -4
- package/v1/types/icrc/account.js +0 -3
- package/v1/types/icrc/account.js.map +0 -1
- package/v1/types/icrc/ledger.d.ts +0 -15
- package/v1/types/icrc/ledger.js +0 -92
- package/v1/types/icrc/ledger.js.map +0 -1
- package/v1/types/icrc/metadata.d.ts +0 -6
- package/v1/types/icrc/metadata.js +0 -3
- package/v1/types/icrc/metadata.js.map +0 -1
- package/v1/types/icrc/transfer.d.ts +0 -9
- package/v1/types/icrc/transfer.js +0 -3
- package/v1/types/icrc/transfer.js.map +0 -1
- package/v1/utils/icrc1.d.ts +0 -16
- package/v1/utils/icrc1.js +0 -109
- package/v1/utils/icrc1.js.map +0 -1
package/package.json
CHANGED
package/v1/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ICPBlockExplorer } from './block-explorer/ICPBlockExplorer';
|
|
2
2
|
import { ICPModule } from './module/ICPModule';
|
|
3
|
-
import { createICPProtocol, createICPProtocolOptions
|
|
4
|
-
import { CkBTCOfflineProtocol, CkBTCOnlineProtocol, createCkBTCOfflineProtocol, createCkBTCOnlineProtocol } from './protocol/icrc/CkBTCProtocol';
|
|
3
|
+
import { ICPProtocol, createICPProtocol, createICPProtocolOptions } from './protocol/ICPProtocol';
|
|
5
4
|
import { ICPTransactionSignRequest } from './serializer/v3/schemas/definitions/transaction-sign-request-icp';
|
|
6
5
|
import { ICPTransactionSignResponse } from './serializer/v3/schemas/definitions/transaction-sign-response-icp';
|
|
7
6
|
import { ICPCryptoConfiguration } from './types/crypto';
|
|
8
7
|
import { ICPProtocolNetwork, ICPProtocolOptions, ICPUnits } from './types/protocol';
|
|
9
8
|
import { ICPSignedTransaction, ICPUnsignedTransaction } from './types/transaction';
|
|
10
9
|
export { ICPModule };
|
|
11
|
-
export { ICPProtocol, createICPProtocol, createICPProtocolOptions
|
|
10
|
+
export { ICPProtocol, createICPProtocol, createICPProtocolOptions };
|
|
12
11
|
export { ICPBlockExplorer };
|
|
13
12
|
export { ICPCryptoConfiguration, ICPUnits, ICPProtocolOptions, ICPProtocolNetwork, ICPUnsignedTransaction, ICPSignedTransaction };
|
|
14
13
|
export { ICPTransactionSignRequest, ICPTransactionSignResponse };
|
package/v1/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ICPBlockExplorer = exports.
|
|
3
|
+
exports.ICPBlockExplorer = exports.createICPProtocolOptions = exports.createICPProtocol = exports.ICPModule = void 0;
|
|
4
4
|
var ICPBlockExplorer_1 = require("./block-explorer/ICPBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "ICPBlockExplorer", { enumerable: true, get: function () { return ICPBlockExplorer_1.ICPBlockExplorer; } });
|
|
6
6
|
var ICPModule_1 = require("./module/ICPModule");
|
|
@@ -8,7 +8,4 @@ Object.defineProperty(exports, "ICPModule", { enumerable: true, get: function ()
|
|
|
8
8
|
var ICPProtocol_1 = require("./protocol/ICPProtocol");
|
|
9
9
|
Object.defineProperty(exports, "createICPProtocol", { enumerable: true, get: function () { return ICPProtocol_1.createICPProtocol; } });
|
|
10
10
|
Object.defineProperty(exports, "createICPProtocolOptions", { enumerable: true, get: function () { return ICPProtocol_1.createICPProtocolOptions; } });
|
|
11
|
-
var CkBTCProtocol_1 = require("./protocol/icrc/CkBTCProtocol");
|
|
12
|
-
Object.defineProperty(exports, "createCkBTCOfflineProtocol", { enumerable: true, get: function () { return CkBTCProtocol_1.createCkBTCOfflineProtocol; } });
|
|
13
|
-
Object.defineProperty(exports, "createCkBTCOnlineProtocol", { enumerable: true, get: function () { return CkBTCProtocol_1.createCkBTCOnlineProtocol; } });
|
|
14
11
|
//# sourceMappingURL=index.js.map
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,sEAAoE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,sEAAoE;AAmB3D,iGAnBA,mCAAgB,OAmBA;AAlBzB,gDAA8C;AAUrC,0FAVA,qBAAS,OAUA;AATlB,sDAAiG;AAa3E,kGAbA,+BAAiB,OAaA;AAAE,yGAbA,sCAAwB,OAaA"}
|
package/v1/module/ICPModule.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MainProtocolSymbols
|
|
1
|
+
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
2
|
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
3
|
-
declare type SupportedProtocols = MainProtocolSymbols.ICP
|
|
3
|
+
declare type SupportedProtocols = MainProtocolSymbols.ICP;
|
|
4
4
|
export declare class ICPModule implements AirGapModule<{
|
|
5
5
|
Protocols: SupportedProtocols;
|
|
6
6
|
}> {
|
|
@@ -10,5 +10,6 @@ export declare class ICPModule implements AirGapModule<{
|
|
|
10
10
|
createOfflineProtocol(identifier: SupportedProtocols): Promise<AirGapOfflineProtocol | undefined>;
|
|
11
11
|
createOnlineProtocol(identifier: SupportedProtocols, networkId?: string): Promise<AirGapOnlineProtocol | undefined>;
|
|
12
12
|
createBlockExplorer(identifier: SupportedProtocols, networkId?: string): Promise<AirGapBlockExplorer | undefined>;
|
|
13
|
+
private createProtocol;
|
|
13
14
|
}
|
|
14
15
|
export {};
|
package/v1/module/ICPModule.js
CHANGED
|
@@ -42,7 +42,6 @@ var errors_1 = require("@airgap/coinlib-core/errors");
|
|
|
42
42
|
var module_kit_1 = require("@airgap/module-kit");
|
|
43
43
|
var ICPBlockExplorer_1 = require("../block-explorer/ICPBlockExplorer");
|
|
44
44
|
var ICPProtocol_1 = require("../protocol/ICPProtocol");
|
|
45
|
-
var CkBTCProtocol_1 = require("../protocol/icrc/CkBTCProtocol");
|
|
46
45
|
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
47
46
|
var ICPModule = /** @class */ (function () {
|
|
48
47
|
function ICPModule() {
|
|
@@ -51,9 +50,6 @@ var ICPModule = /** @class */ (function () {
|
|
|
51
50
|
_a[coinlib_core_1.MainProtocolSymbols.ICP] = new module_kit_1.ModuleNetworkRegistry({
|
|
52
51
|
supportedNetworks: [ICPProtocol_1.ICP_MAINNET_PROTOCOL_NETWORK]
|
|
53
52
|
}),
|
|
54
|
-
_a[coinlib_core_1.SubProtocolSymbols.ICP_CKBTC] = new module_kit_1.ModuleNetworkRegistry({
|
|
55
|
-
supportedNetworks: [CkBTCProtocol_1.CKBTC_MAINNET_PROTOCOL_NETWORK]
|
|
56
|
-
}),
|
|
57
53
|
_a);
|
|
58
54
|
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
59
55
|
}
|
|
@@ -67,15 +63,7 @@ var ICPModule = /** @class */ (function () {
|
|
|
67
63
|
ICPModule.prototype.createOfflineProtocol = function (identifier) {
|
|
68
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
69
65
|
return __generator(this, function (_a) {
|
|
70
|
-
|
|
71
|
-
case coinlib_core_1.MainProtocolSymbols.ICP:
|
|
72
|
-
return [2 /*return*/, (0, ICPProtocol_1.createICPProtocol)()];
|
|
73
|
-
case coinlib_core_1.SubProtocolSymbols.ICP_CKBTC:
|
|
74
|
-
return [2 /*return*/, (0, CkBTCProtocol_1.createCkBTCOfflineProtocol)()];
|
|
75
|
-
default:
|
|
76
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, "Protocol ".concat(identifier, " not supported."));
|
|
77
|
-
}
|
|
78
|
-
return [2 /*return*/];
|
|
66
|
+
return [2 /*return*/, this.createProtocol(identifier)];
|
|
79
67
|
});
|
|
80
68
|
});
|
|
81
69
|
};
|
|
@@ -88,15 +76,7 @@ var ICPModule = /** @class */ (function () {
|
|
|
88
76
|
if (network === undefined) {
|
|
89
77
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, 'Protocol network not supported.');
|
|
90
78
|
}
|
|
91
|
-
|
|
92
|
-
case coinlib_core_1.MainProtocolSymbols.ICP:
|
|
93
|
-
return [2 /*return*/, (0, ICPProtocol_1.createICPProtocol)({ network: network })];
|
|
94
|
-
case coinlib_core_1.SubProtocolSymbols.ICP_CKBTC:
|
|
95
|
-
return [2 /*return*/, (0, CkBTCProtocol_1.createCkBTCOnlineProtocol)({ network: network })];
|
|
96
|
-
default:
|
|
97
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, "Protocol ".concat(identifier, " not supported."));
|
|
98
|
-
}
|
|
99
|
-
return [2 /*return*/];
|
|
79
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
100
80
|
});
|
|
101
81
|
});
|
|
102
82
|
};
|
|
@@ -113,6 +93,14 @@ var ICPModule = /** @class */ (function () {
|
|
|
113
93
|
});
|
|
114
94
|
});
|
|
115
95
|
};
|
|
96
|
+
ICPModule.prototype.createProtocol = function (identifier, network) {
|
|
97
|
+
switch (identifier) {
|
|
98
|
+
case coinlib_core_1.MainProtocolSymbols.ICP:
|
|
99
|
+
return (0, ICPProtocol_1.createICPProtocol)({ network: network });
|
|
100
|
+
default:
|
|
101
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, "Protocol ".concat(identifier, " not supported."));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
116
104
|
return ICPModule;
|
|
117
105
|
}());
|
|
118
106
|
exports.ICPModule = ICPModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICPModule.js","sourceRoot":"","sources":["../../../src/v1/module/ICPModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ICPModule.js","sourceRoot":"","sources":["../../../src/v1/module/ICPModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAW2B;AAE3B,uEAAqE;AACrE,uDAAyF;AACzF,8EAAgF;AAIhF;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,GAAG,IAAG,IAAI,kCAAqB,CAAC;gBACnD,iBAAiB,EAAE,C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IAAI,gCAAuB,CAAC,qBAAM,CAAC,GAAG,EAAE,mBAAY,UAAU,oBAAiB,CAAC,CAAA;SACzF;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AA1CD,IA0CC;AA1CY,8BAAS"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import 'isomorphic-fetch';
|
|
3
|
-
import { Identity } from '../utils/auth';
|
|
4
|
-
import { HttpAgent } from '../utils/http';
|
|
5
|
-
import { Principal } from '../utils/principal';
|
|
6
2
|
interface Transaction {
|
|
7
3
|
to: string;
|
|
8
4
|
amount: bigint;
|
|
9
5
|
fee: bigint;
|
|
10
6
|
}
|
|
11
|
-
export declare function createHttpAgent(rpcUrl: string, identity?: Identity): HttpAgent;
|
|
12
7
|
export declare function getKeyPairFromExtendedSecretKey(extendedSecretKey: string): {
|
|
13
8
|
publicKey: string;
|
|
14
9
|
privateKey: string;
|
|
15
10
|
};
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function getAddressFromPublicKey(publicKey: string, subAccount?: string | Buffer | Uint8Array): string;
|
|
18
|
-
export declare function getAddressFromPrincipal(principalOrText: Principal | string, subAccountOrUndefined?: string | Buffer | Uint8Array): string;
|
|
11
|
+
export declare function getAddressFromPublicKey(publicKey: string, subAccount?: Uint8Array): string;
|
|
19
12
|
export declare function createUnsignedTransaction(transaction: Transaction): string;
|
|
20
13
|
export declare function getInfoFromUnsignedTransaction(unsignedTransaction: string): {
|
|
21
14
|
to: string;
|
|
@@ -25,10 +18,9 @@ export declare function getInfoFromUnsignedTransaction(unsignedTransaction: stri
|
|
|
25
18
|
created_at_time: any[];
|
|
26
19
|
amount: bigint;
|
|
27
20
|
};
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function signTransaction(privateKey: string, canisterId: string, arg: any): Promise<string>;
|
|
21
|
+
export declare function signTransaction(unsignedTransaction: string, privateKey: string): Promise<string>;
|
|
30
22
|
export declare function getInfoFromSignedTransaction(signedTransaction: string): any;
|
|
31
23
|
export declare function decodeArguments(args: ArrayBuffer): any;
|
|
32
|
-
export declare function getBalanceFromAddress(address: string, host: string
|
|
33
|
-
export declare function broadcastTransaction(signedTransaction: string, host: string
|
|
24
|
+
export declare function getBalanceFromAddress(address: string, host: string): Promise<bigint>;
|
|
25
|
+
export declare function broadcastTransaction(signedTransaction: string, host: string): Promise<string>;
|
|
34
26
|
export {};
|
|
@@ -98,32 +98,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
98
98
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
99
99
|
};
|
|
100
100
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
101
|
-
exports.broadcastTransaction = exports.getBalanceFromAddress = exports.decodeArguments = exports.getInfoFromSignedTransaction = exports.signTransaction = exports.
|
|
102
|
-
var index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
|
|
103
|
-
var hex_1 = require("@airgap/coinlib-core/utils/hex");
|
|
101
|
+
exports.broadcastTransaction = exports.getBalanceFromAddress = exports.decodeArguments = exports.getInfoFromSignedTransaction = exports.signTransaction = exports.getInfoFromUnsignedTransaction = exports.createUnsignedTransaction = exports.getAddressFromPublicKey = exports.getKeyPairFromExtendedSecretKey = void 0;
|
|
104
102
|
require("isomorphic-fetch");
|
|
103
|
+
var convert_1 = require("../utils/convert");
|
|
105
104
|
var js_sha256_1 = require("js-sha256");
|
|
106
105
|
var ledger_1 = require("../types/ledger");
|
|
106
|
+
var index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
|
|
107
|
+
var IDL = __importStar(require("../utils/idl"));
|
|
108
|
+
var principal_1 = require("../utils/principal");
|
|
109
|
+
var secp256k1_1 = __importDefault(require("../utils/secp256k1"));
|
|
110
|
+
var http_1 = require("../utils/http");
|
|
107
111
|
var account_1 = require("../utils/account");
|
|
108
112
|
// import { requestIdOf } from '../utils/auth'
|
|
109
113
|
var actor_1 = require("../utils/actor");
|
|
110
|
-
var auth_1 = require("../utils/auth");
|
|
111
114
|
var Cbor = __importStar(require("../utils/cbor"));
|
|
112
|
-
var convert_1 = require("../utils/convert");
|
|
113
115
|
var hdkey_1 = __importDefault(require("../utils/hdkey"));
|
|
114
|
-
var http_1 = require("../utils/http");
|
|
115
|
-
var IDL = __importStar(require("../utils/idl"));
|
|
116
|
-
var principal_1 = require("../utils/principal");
|
|
117
|
-
var secp256k1_1 = __importDefault(require("../utils/secp256k1"));
|
|
118
|
-
// Agent
|
|
119
|
-
function createHttpAgent(rpcUrl, identity) {
|
|
120
|
-
if (identity === void 0) { identity = new auth_1.AnonymousIdentity(); }
|
|
121
|
-
return new http_1.HttpAgent({
|
|
122
|
-
identity: identity,
|
|
123
|
-
host: rpcUrl
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
exports.createHttpAgent = createHttpAgent;
|
|
127
116
|
// MNEMONIC -> KEY PAIR
|
|
128
117
|
function getKeyPairFromExtendedSecretKey(extendedSecretKey) {
|
|
129
118
|
var hdKey = hdkey_1.default.fromExtendedKey(extendedSecretKey);
|
|
@@ -137,38 +126,20 @@ function getKeyPairFromExtendedSecretKey(extendedSecretKey) {
|
|
|
137
126
|
}
|
|
138
127
|
exports.getKeyPairFromExtendedSecretKey = getKeyPairFromExtendedSecretKey;
|
|
139
128
|
// PUBLIC KEY -> ADDRESS
|
|
140
|
-
function getPrincipalFromPublicKey(publicKey) {
|
|
141
|
-
return principal_1.Principal.selfAuthenticating((0, convert_1.hexStringToUint8Array)(publicKey));
|
|
142
|
-
}
|
|
143
|
-
exports.getPrincipalFromPublicKey = getPrincipalFromPublicKey;
|
|
144
129
|
function getAddressFromPublicKey(publicKey, subAccount) {
|
|
145
130
|
// Get principal from public key
|
|
146
|
-
var principal =
|
|
147
|
-
return getAddressFromPrincipal(principal, subAccount);
|
|
148
|
-
}
|
|
149
|
-
exports.getAddressFromPublicKey = getAddressFromPublicKey;
|
|
150
|
-
function getAddressFromPrincipal(principalOrText, subAccountOrUndefined) {
|
|
151
|
-
var principal = typeof principalOrText === 'string'
|
|
152
|
-
? (0, hex_1.isHex)(principalOrText)
|
|
153
|
-
? principal_1.Principal.fromHex(principalOrText)
|
|
154
|
-
: principal_1.Principal.from(principalOrText)
|
|
155
|
-
: principalOrText;
|
|
156
|
-
var subAccount = typeof subAccountOrUndefined === 'string'
|
|
157
|
-
? Buffer.from(subAccountOrUndefined, 'hex')
|
|
158
|
-
: typeof subAccountOrUndefined === 'undefined' || subAccountOrUndefined.length === 0
|
|
159
|
-
? Buffer.alloc(32, 0)
|
|
160
|
-
: subAccountOrUndefined;
|
|
131
|
+
var principal = principal_1.Principal.selfAuthenticating((0, convert_1.hexStringToUint8Array)(publicKey));
|
|
161
132
|
// Hash (sha224) the principal, the subAccount and some padding
|
|
162
133
|
var padding = (0, convert_1.asciiStringToByteArray)('\x0Aaccount-id');
|
|
163
134
|
var shaObj = js_sha256_1.sha224.create();
|
|
164
|
-
shaObj.update(__spreadArray(__spreadArray(__spreadArray([], __read(padding), false), __read(principal.toUint8Array()), false), __read(subAccount), false));
|
|
135
|
+
shaObj.update(__spreadArray(__spreadArray(__spreadArray([], __read(padding), false), __read(principal.toUint8Array()), false), __read((subAccount !== null && subAccount !== void 0 ? subAccount : Array(32).fill(0))), false));
|
|
165
136
|
var hash = new Uint8Array(shaObj.array());
|
|
166
137
|
// Prepend the checksum of the hash and convert to a hex string
|
|
167
138
|
var checksum = (0, convert_1.calculateCrc32)(hash);
|
|
168
139
|
var bytes = new Uint8Array(__spreadArray(__spreadArray([], __read(checksum), false), __read(hash), false));
|
|
169
140
|
return (0, convert_1.uint8ArrayToHexString)(bytes);
|
|
170
141
|
}
|
|
171
|
-
exports.
|
|
142
|
+
exports.getAddressFromPublicKey = getAddressFromPublicKey;
|
|
172
143
|
// TRANSACTION OBJECT -> UNSIGNED TRANSACTION HEX
|
|
173
144
|
function createUnsignedTransaction(transaction) {
|
|
174
145
|
var to = account_1.AccountIdentifier.fromHex(transaction.to);
|
|
@@ -203,57 +174,50 @@ function getInfoFromUnsignedTransaction(unsignedTransaction) {
|
|
|
203
174
|
}
|
|
204
175
|
exports.getInfoFromUnsignedTransaction = getInfoFromUnsignedTransaction;
|
|
205
176
|
// UNSIGNED TRANSACTION, PRIVATE KEY -> SIGNED TRANSACTION
|
|
206
|
-
function
|
|
177
|
+
function signTransaction(unsignedTransaction, privateKey) {
|
|
207
178
|
return __awaiter(this, void 0, void 0, function () {
|
|
208
|
-
var transactionDetails, Address, ICP, Memo, SubAccount, TimeStamp, TransferArgs, DEFAULT_TRANSACTION_FEE, toTransferRawRequest, rawRequestBody, args;
|
|
209
|
-
return __generator(this, function (_a) {
|
|
210
|
-
transactionDetails = getInfoFromUnsignedTransaction(unsignedTransaction);
|
|
211
|
-
Address = IDL.Vec(IDL.Nat8);
|
|
212
|
-
ICP = IDL.Record({ e8s: IDL.Nat64 });
|
|
213
|
-
Memo = IDL.Nat64;
|
|
214
|
-
SubAccount = IDL.Vec(IDL.Nat8);
|
|
215
|
-
TimeStamp = IDL.Record({ timestamp_nanos: IDL.Nat64 });
|
|
216
|
-
TransferArgs = IDL.Record({
|
|
217
|
-
to: Address,
|
|
218
|
-
fee: ICP,
|
|
219
|
-
memo: Memo,
|
|
220
|
-
from_subaccount: IDL.Opt(SubAccount),
|
|
221
|
-
created_at_time: IDL.Opt(TimeStamp),
|
|
222
|
-
amount: ICP
|
|
223
|
-
});
|
|
224
|
-
DEFAULT_TRANSACTION_FEE = BigInt(10000);
|
|
225
|
-
toTransferRawRequest = function (_a) {
|
|
226
|
-
var to = _a.to, amount = _a.amount, memo = _a.memo, fee = _a.fee, fromSubAccount = _a.fromSubAccount;
|
|
227
|
-
return {
|
|
228
|
-
to: to.toNumbers(),
|
|
229
|
-
fee: (0, convert_1.e8sToTokens)(fee !== null && fee !== void 0 ? fee : DEFAULT_TRANSACTION_FEE),
|
|
230
|
-
amount: (0, convert_1.e8sToTokens)(amount),
|
|
231
|
-
// Always explicitly set the memo for compatibility with ledger wallet - hardware wallet
|
|
232
|
-
memo: memo !== null && memo !== void 0 ? memo : BigInt(0),
|
|
233
|
-
created_at_time: [],
|
|
234
|
-
from_subaccount: fromSubAccount === undefined ? [] : [fromSubAccount]
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
rawRequestBody = toTransferRawRequest(__assign(__assign({}, transactionDetails), { to: account_1.AccountIdentifier.fromHex(transactionDetails.to) }));
|
|
238
|
-
args = IDL.encode([TransferArgs], [rawRequestBody]);
|
|
239
|
-
return [2 /*return*/, signTransaction(privateKey, canisterId, args)];
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
exports.signICPTransaction = signICPTransaction;
|
|
244
|
-
function signTransaction(privateKey, canisterId, arg) {
|
|
245
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
246
|
-
var identity, submit, transform, request, transformedRequest, encoded;
|
|
179
|
+
var identity, transactionDetails, Address, ICP, Memo, SubAccount, TimeStamp, TransferArgs, DEFAULT_TRANSACTION_FEE, toTransferRawRequest, rawRequestBody, args, submit, transform, request, transformedRequest, encoded;
|
|
247
180
|
var _this = this;
|
|
248
181
|
return __generator(this, function (_a) {
|
|
249
182
|
switch (_a.label) {
|
|
250
183
|
case 0:
|
|
251
184
|
identity = secp256k1_1.default.fromSecretKey((0, convert_1.hexStringToArrayBuffer)(privateKey));
|
|
185
|
+
transactionDetails = getInfoFromUnsignedTransaction(unsignedTransaction);
|
|
186
|
+
Address = IDL.Vec(IDL.Nat8);
|
|
187
|
+
ICP = IDL.Record({ e8s: IDL.Nat64 });
|
|
188
|
+
Memo = IDL.Nat64;
|
|
189
|
+
SubAccount = IDL.Vec(IDL.Nat8);
|
|
190
|
+
TimeStamp = IDL.Record({ timestamp_nanos: IDL.Nat64 });
|
|
191
|
+
TransferArgs = IDL.Record({
|
|
192
|
+
to: Address,
|
|
193
|
+
fee: ICP,
|
|
194
|
+
memo: Memo,
|
|
195
|
+
from_subaccount: IDL.Opt(SubAccount),
|
|
196
|
+
created_at_time: IDL.Opt(TimeStamp),
|
|
197
|
+
amount: ICP
|
|
198
|
+
});
|
|
199
|
+
DEFAULT_TRANSACTION_FEE = BigInt(10000);
|
|
200
|
+
toTransferRawRequest = function (_a) {
|
|
201
|
+
var to = _a.to, amount = _a.amount, memo = _a.memo, fee = _a.fee, fromSubAccount = _a.fromSubAccount;
|
|
202
|
+
return {
|
|
203
|
+
to: to.toNumbers(),
|
|
204
|
+
fee: (0, convert_1.e8sToTokens)(fee !== null && fee !== void 0 ? fee : DEFAULT_TRANSACTION_FEE),
|
|
205
|
+
amount: (0, convert_1.e8sToTokens)(amount),
|
|
206
|
+
// Always explicitly set the memo for compatibility with ledger wallet - hardware wallet
|
|
207
|
+
memo: memo !== null && memo !== void 0 ? memo : BigInt(0),
|
|
208
|
+
created_at_time: [],
|
|
209
|
+
from_subaccount: fromSubAccount === undefined ? [] : [fromSubAccount]
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
rawRequestBody = toTransferRawRequest(__assign(__assign({}, transactionDetails), { to: account_1.AccountIdentifier.fromHex(transactionDetails.to) }));
|
|
213
|
+
args = IDL.encode([TransferArgs], [rawRequestBody]);
|
|
252
214
|
submit = {
|
|
253
215
|
request_type: http_1.SubmitRequestType.Call,
|
|
254
|
-
|
|
216
|
+
//@ts-ignore
|
|
217
|
+
canister_id: principal_1.Principal.from(ledger_1.canisterId),
|
|
255
218
|
method_name: 'transfer',
|
|
256
|
-
arg:
|
|
219
|
+
arg: args,
|
|
220
|
+
//@ts-ignore
|
|
257
221
|
sender: identity.getPrincipal(),
|
|
258
222
|
ingress_expiry: new http_1.Expiry(5 * 60 * 1000)
|
|
259
223
|
};
|
|
@@ -310,16 +274,20 @@ function decodeArguments(args) {
|
|
|
310
274
|
}
|
|
311
275
|
exports.decodeArguments = decodeArguments;
|
|
312
276
|
// ADDRESS -> BALANCE
|
|
313
|
-
function getBalanceFromAddress(address, host
|
|
277
|
+
function getBalanceFromAddress(address, host) {
|
|
314
278
|
return __awaiter(this, void 0, void 0, function () {
|
|
315
|
-
var agent, actor, acc, b;
|
|
279
|
+
var identity, agent, actor, acc, b;
|
|
316
280
|
return __generator(this, function (_a) {
|
|
317
281
|
switch (_a.label) {
|
|
318
282
|
case 0:
|
|
319
|
-
|
|
283
|
+
identity = secp256k1_1.default.generate();
|
|
284
|
+
agent = new http_1.HttpAgent({
|
|
285
|
+
identity: identity,
|
|
286
|
+
host: host
|
|
287
|
+
});
|
|
320
288
|
actor = actor_1.Actor.createActor(ledger_1.idlFactory, {
|
|
321
289
|
agent: agent,
|
|
322
|
-
canisterId: canisterId
|
|
290
|
+
canisterId: ledger_1.canisterId
|
|
323
291
|
});
|
|
324
292
|
acc = Uint8Array.from(Buffer.from(address, 'hex'));
|
|
325
293
|
return [4 /*yield*/, actor.account_balance({
|
|
@@ -333,13 +301,13 @@ function getBalanceFromAddress(address, host, canisterId) {
|
|
|
333
301
|
});
|
|
334
302
|
}
|
|
335
303
|
exports.getBalanceFromAddress = getBalanceFromAddress;
|
|
336
|
-
function broadcastTransaction(signedTransaction, host
|
|
304
|
+
function broadcastTransaction(signedTransaction, host) {
|
|
337
305
|
return __awaiter(this, void 0, void 0, function () {
|
|
338
306
|
var canister, body, error_1;
|
|
339
307
|
return __generator(this, function (_a) {
|
|
340
308
|
switch (_a.label) {
|
|
341
309
|
case 0:
|
|
342
|
-
canister = principal_1.Principal.from(canisterId);
|
|
310
|
+
canister = principal_1.Principal.from(ledger_1.canisterId);
|
|
343
311
|
body = (0, convert_1.hexStringToArrayBuffer)(signedTransaction);
|
|
344
312
|
_a.label = 1;
|
|
345
313
|
case 1:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICPImplementation.js","sourceRoot":"","sources":["../../../src/v1/protocol/ICPImplementation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,iBAAyB,EAAE,IAAY;;;;;;oBAC1E,QAAQ,GAAG,qBAAS,CAAC,IAAI,CAAC,mBAAgB,CAAC,CAAA;oBAE3C,IAAI,GAAG,IAAA,gCAAsB,EAAC,iBAAiB,CAAC,CAAA;;;;oBAIpD,oBAAoB,CAAC,qBAAM,eAAK,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,2BAAoB,QAAQ,CAAC,MAAM,EAAE,UAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;4BAC5G,OAAO,EAAE;gCACP,cAAc,EAAE,kBAAkB;6BACnC;yBACF,CAAC;wBAEF,gCAAgC;wBAChC,sCAAsC;wBACtC,qCAAqC;wBACrC,IAAI;wBAEJ,oDAAoD;sBAPlD;;oBAJF,oBAAoB,CAAC,SAInB,CAAA;oBAEF,gCAAgC;oBAChC,sCAAsC;oBACtC,qCAAqC;oBACrC,IAAI;oBAEJ,oDAAoD;oBAEpD,sBAAO,EAAE,EAAA;;;oBAET,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,OAAK,CAAC,CAAA;oBAC/B,sBAAO,EAAE,EAAA;;;;;CAEZ;AAzBD,oDAyBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, AirGapProtocol, AirGapTransaction, AirGapTransactionsWithCursor, Amount, Balance, CryptoDerivative, FeeDefaults, KeyPair,
|
|
1
|
+
import { Address, AirGapProtocol, AirGapTransaction, AirGapTransactionsWithCursor, Amount, Balance, CryptoDerivative, FeeDefaults, KeyPair, ProtocolMetadata, PublicKey, RecursivePartial, SecretKey, TransactionConfiguration, TransactionDetails } from '@airgap/module-kit';
|
|
2
2
|
import { ICPCryptoConfiguration } from '../types/crypto';
|
|
3
3
|
import { ICPProtocolNetwork, ICPProtocolOptions, ICPUnits } from '../types/protocol';
|
|
4
4
|
import { ICPSignedTransaction, ICPTransactionCursor, ICPUnsignedTransaction } from '../types/transaction';
|
|
@@ -13,9 +13,6 @@ export interface ICPProtocol extends AirGapProtocol<{
|
|
|
13
13
|
UnsignedTransaction: ICPUnsignedTransaction;
|
|
14
14
|
}, 'FetchDataForAddress'> {
|
|
15
15
|
}
|
|
16
|
-
export declare const ICP_DERIVATION_PATH: string;
|
|
17
|
-
export declare const ICP_ACCOUNT_METADATA: ProtocolAccountMetadata;
|
|
18
|
-
export declare function ICP_TRANSACTION_METADATA<_Units extends string = ICPUnits>(): ProtocolTransactionMetadata<_Units>;
|
|
19
16
|
export declare class ICPProtocolImpl implements ICPProtocol {
|
|
20
17
|
private readonly options;
|
|
21
18
|
constructor(options?: RecursivePartial<ICPProtocolOptions>);
|
|
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.createICPProtocolOptions = exports.ICP_MAINNET_PROTOCOL_NETWORK = exports.createICPProtocol = exports.ICPProtocolImpl =
|
|
53
|
+
exports.createICPProtocolOptions = exports.ICP_MAINNET_PROTOCOL_NETWORK = exports.createICPProtocol = exports.ICPProtocolImpl = void 0;
|
|
54
54
|
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
55
55
|
var index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
|
|
56
56
|
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
@@ -60,23 +60,6 @@ var module_kit_1 = require("@airgap/module-kit");
|
|
|
60
60
|
var convert_1 = require("../utils/convert");
|
|
61
61
|
var ICPImplementation_1 = require("./ICPImplementation");
|
|
62
62
|
// Implementation
|
|
63
|
-
exports.ICP_DERIVATION_PATH = "m/44'/223'/0'/0/0";
|
|
64
|
-
exports.ICP_ACCOUNT_METADATA = {
|
|
65
|
-
standardDerivationPath: exports.ICP_DERIVATION_PATH,
|
|
66
|
-
address: {
|
|
67
|
-
isCaseSensitive: true,
|
|
68
|
-
placeholder: '',
|
|
69
|
-
regex: '^[a-f0-9]{64}$'
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
function ICP_TRANSACTION_METADATA() {
|
|
73
|
-
return {
|
|
74
|
-
arbitraryData: {
|
|
75
|
-
inner: { name: 'payload' }
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
exports.ICP_TRANSACTION_METADATA = ICP_TRANSACTION_METADATA;
|
|
80
63
|
var ICPProtocolImpl = /** @class */ (function () {
|
|
81
64
|
function ICPProtocolImpl(options) {
|
|
82
65
|
if (options === void 0) { options = {}; }
|
|
@@ -100,8 +83,19 @@ var ICPProtocolImpl = /** @class */ (function () {
|
|
|
100
83
|
fee: {
|
|
101
84
|
defaults: this.feeDefaults
|
|
102
85
|
},
|
|
103
|
-
account:
|
|
104
|
-
|
|
86
|
+
account: {
|
|
87
|
+
standardDerivationPath: "m/44'/223'/0'/0/0",
|
|
88
|
+
address: {
|
|
89
|
+
isCaseSensitive: true,
|
|
90
|
+
placeholder: '',
|
|
91
|
+
regex: '^[a-f0-9]{64}$'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
transaction: {
|
|
95
|
+
arbitraryData: {
|
|
96
|
+
inner: { name: 'payload' }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
105
99
|
};
|
|
106
100
|
// Offline
|
|
107
101
|
this.cryptoConfiguration = {
|
|
@@ -190,7 +184,7 @@ var ICPProtocolImpl = /** @class */ (function () {
|
|
|
190
184
|
if (secretKey.format !== 'hex') {
|
|
191
185
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, 'Secret key is of an unexpected format.');
|
|
192
186
|
}
|
|
193
|
-
return [4 /*yield*/, (0, ICPImplementation_1.
|
|
187
|
+
return [4 /*yield*/, (0, ICPImplementation_1.signTransaction)(transaction.transaction, secretKey.value)];
|
|
194
188
|
case 1:
|
|
195
189
|
signedTransaction = _a.sent();
|
|
196
190
|
return [2 /*return*/, (0, module_kit_1.newSignedTransaction)({ transaction: signedTransaction })];
|
|
@@ -288,7 +282,7 @@ var ICPProtocolImpl = /** @class */ (function () {
|
|
|
288
282
|
case 0:
|
|
289
283
|
if (!address)
|
|
290
284
|
return [2 /*return*/, { total: (0, module_kit_1.newAmount)(0, 'blockchain') }];
|
|
291
|
-
return [4 /*yield*/, (0, ICPImplementation_1.getBalanceFromAddress)(address, this.options.network.rpcUrl
|
|
285
|
+
return [4 /*yield*/, (0, ICPImplementation_1.getBalanceFromAddress)(address, this.options.network.rpcUrl)];
|
|
292
286
|
case 1:
|
|
293
287
|
balance = _a.sent();
|
|
294
288
|
return [2 /*return*/, { total: (0, module_kit_1.newAmount)(balance.toString(10), 'blockchain') }];
|
|
@@ -390,7 +384,7 @@ var ICPProtocolImpl = /** @class */ (function () {
|
|
|
390
384
|
return __awaiter(this, void 0, void 0, function () {
|
|
391
385
|
return __generator(this, function (_a) {
|
|
392
386
|
switch (_a.label) {
|
|
393
|
-
case 0: return [4 /*yield*/, (0, ICPImplementation_1.broadcastTransaction)(transaction.transaction, this.options.network.rpcUrl
|
|
387
|
+
case 0: return [4 /*yield*/, (0, ICPImplementation_1.broadcastTransaction)(transaction.transaction, this.options.network.rpcUrl)];
|
|
394
388
|
case 1: return [2 /*return*/, _a.sent()];
|
|
395
389
|
}
|
|
396
390
|
});
|
|
@@ -409,7 +403,6 @@ exports.ICP_MAINNET_PROTOCOL_NETWORK = {
|
|
|
409
403
|
name: 'Mainnet',
|
|
410
404
|
type: 'mainnet',
|
|
411
405
|
rpcUrl: 'https://boundary.ic0.app/',
|
|
412
|
-
canisterId: 'ryjl3-tyaaa-aaaaa-aaaba-cai',
|
|
413
406
|
explorerUrl: 'https://ledger-api.internetcomputer.org'
|
|
414
407
|
};
|
|
415
408
|
var DEFAULT_ICP_PROTOCOL_NETWORK = exports.ICP_MAINNET_PROTOCOL_NETWORK;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICPProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/ICPProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA+E;AAC/E,mGAA4E;AAC5E,iHAA0F;AAC1F,sDAAqG;AACrG,yCAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"ICPProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/ICPProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA+E;AAC/E,mGAA4E;AAC5E,iHAA0F;AAC1F,sDAAqG;AACrG,yCAAiD;AACjD,iDAsB2B;AAK3B,4CAAwD;AAExD,yDAU4B;AAmB5B,iBAAiB;AAEjB;IAGE,yBAAmB,OAAkD;QAAlD,wBAAA,EAAA,YAAkD;QAIrE,SAAS;QACQ,UAAK,GAAoC;YACxD,GAAG,EAAE;gBACH,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;gBACvC,QAAQ,EAAE,CAAC;aACZ;SACF,CAAA;QAEgB,gBAAW,GAA0B;YACpD,GAAG,EAAE,IAAA,sBAAS,EAAC,MAAM,EAAE,KAAK,CAAC;YAC7B,MAAM,EAAE,IAAA,sBAAS,EAAC,MAAM,EAAE,KAAK,CAAC;YAChC,IAAI,EAAE,IAAA,sBAAS,EAAC,MAAM,EAAE,KAAK,CAAC;SAC/B,CAAA;QAEgB,aAAQ,GAA+B;YACtD,UAAU,EAAE,kCAAmB,CAAC,GAAG;YACnC,IAAI,EAAE,4BAA4B;YAElC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,KAAK;YAEf,GAAG,EAAE;gBACH,QAAQ,EAAE,IAAI,CAAC,WAAW;aAC3B;YAED,OAAO,EAAE;gBACP,sBAAsB,EAAE,mBAAmB;gBAC3C,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