@airgap/icp 0.13.15-beta.1 → 0.13.15-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -6
- package/v1/block-explorer/ICPBlockExplorer.d.ts +1 -1
- package/v1/block-explorer/ICPBlockExplorer.js +16 -49
- package/v1/block-explorer/ICPBlockExplorer.js.map +1 -1
- package/v1/index.d.ts +2 -2
- package/v1/index.js +7 -5
- package/v1/index.js.map +1 -1
- package/v1/module/ICPModule.d.ts +2 -4
- package/v1/module/ICPModule.js +53 -94
- package/v1/module/ICPModule.js.map +1 -1
- package/v1/module.js +1 -1
- package/v1/module.js.map +1 -1
- package/v1/protocol/ICPGovernance.d.ts +38 -0
- package/v1/protocol/ICPGovernance.js +748 -0
- package/v1/protocol/ICPGovernance.js.map +1 -0
- package/v1/protocol/ICPImplementation.d.ts +27 -5
- package/v1/protocol/ICPImplementation.js +368 -250
- package/v1/protocol/ICPImplementation.js.map +1 -1
- package/v1/protocol/ICPProtocol.d.ts +33 -8
- package/v1/protocol/ICPProtocol.js +508 -322
- package/v1/protocol/ICPProtocol.js.map +1 -1
- package/v1/protocol/icrc/CkBTCProtocol.js +138 -225
- package/v1/protocol/icrc/CkBTCProtocol.js.map +1 -1
- package/v1/protocol/icrc/ICRC1Protocol.d.ts +4 -4
- package/v1/protocol/icrc/ICRC1Protocol.js +338 -553
- package/v1/protocol/icrc/ICRC1Protocol.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +17 -4
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-icp.json +35 -6
- package/v1/serializer/v3/serializer-companion.js +86 -144
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +22 -60
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +19 -58
- package/v1/serializer/v3/validators/validators.js.map +1 -1
- package/v1/types/governance.d.ts +2 -0
- package/v1/types/governance.js +268 -210
- package/v1/types/governance.js.map +1 -1
- package/v1/types/icrc/ledger.js +22 -23
- package/v1/types/icrc/ledger.js.map +1 -1
- package/v1/types/ledger.d.ts +1 -0
- package/v1/types/ledger.js +37 -38
- package/v1/types/ledger.js.map +1 -1
- package/v1/types/management_idl.js +6 -7
- package/v1/types/management_idl.js.map +1 -1
- package/v1/types/protocol.d.ts +2 -1
- package/v1/types/transaction.d.ts +21 -3
- package/v1/types/transaction.js +28 -0
- package/v1/types/transaction.js.map +1 -1
- package/v1/utils/account.js +42 -70
- package/v1/utils/account.js.map +1 -1
- package/v1/utils/actor.js +139 -322
- package/v1/utils/actor.js.map +1 -1
- package/v1/utils/auth.js +44 -134
- package/v1/utils/auth.js.map +1 -1
- package/v1/utils/bls.js +41 -109
- package/v1/utils/bls.js.map +1 -1
- package/v1/utils/buffer.js +47 -111
- package/v1/utils/buffer.js.map +1 -1
- package/v1/utils/cbor.js +50 -85
- package/v1/utils/cbor.js.map +1 -1
- package/v1/utils/certificate.js +116 -238
- package/v1/utils/certificate.js.map +1 -1
- package/v1/utils/convert.d.ts +1 -1
- package/v1/utils/convert.js +29 -49
- package/v1/utils/convert.js.map +1 -1
- package/v1/utils/der.js +37 -35
- package/v1/utils/der.js.map +1 -1
- package/v1/utils/errors.js +10 -30
- package/v1/utils/errors.js.map +1 -1
- package/v1/utils/hdkey.js +33 -33
- package/v1/utils/hdkey.js.map +1 -1
- package/v1/utils/http.d.ts +1 -1
- package/v1/utils/http.js +202 -426
- package/v1/utils/http.js.map +1 -1
- package/v1/utils/icrc1.js +24 -41
- package/v1/utils/icrc1.js.map +1 -1
- package/v1/utils/idl.js +780 -1159
- package/v1/utils/idl.js.map +1 -1
- package/v1/utils/leb128.js +29 -30
- package/v1/utils/leb128.js.map +1 -1
- package/v1/utils/polling.js +84 -234
- package/v1/utils/polling.js.map +1 -1
- package/v1/utils/principal.js +78 -126
- package/v1/utils/principal.js.map +1 -1
- package/v1/utils/secp256k1.js +68 -134
- package/v1/utils/secp256k1.js.map +1 -1
- package/v1/utils/transaction.js +7 -7
- package/v1/utils/transaction.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/icp",
|
|
3
|
-
"version": "0.13.15-beta.
|
|
3
|
+
"version": "0.13.15-beta.3",
|
|
4
4
|
"description": "The @airgap/icp is an ICP implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -30,15 +30,17 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@airgap/coinlib-core": "^0.13.15-beta.
|
|
34
|
-
"@airgap/crypto": "^0.13.15-beta.
|
|
35
|
-
"@airgap/module-kit": "^0.13.15-beta.
|
|
36
|
-
"@airgap/serializer": "^0.13.15-beta.
|
|
33
|
+
"@airgap/coinlib-core": "^0.13.15-beta.3",
|
|
34
|
+
"@airgap/crypto": "^0.13.15-beta.3",
|
|
35
|
+
"@airgap/module-kit": "^0.13.15-beta.3",
|
|
36
|
+
"@airgap/serializer": "^0.13.15-beta.3",
|
|
37
|
+
"@dfinity/agent": "^0.15.4",
|
|
38
|
+
"@dfinity/identity-secp256k1": "^0.15.4",
|
|
39
|
+
"@dfinity/nns": "^0.14.0",
|
|
37
40
|
"@stablelib/ed25519": "^1.0.3",
|
|
38
41
|
"base64-arraybuffer": "^1.0.2",
|
|
39
42
|
"bip39": "^3.0.4",
|
|
40
43
|
"borc": "^3.0.0",
|
|
41
|
-
"crc": "4.3.2",
|
|
42
44
|
"crc-32": "1.2.2",
|
|
43
45
|
"isomorphic-fetch": "^3.0.0",
|
|
44
46
|
"js-sha256": "^0.9.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AirGapBlockExplorer, BlockExplorerMetadata } from '@airgap/module-kit';
|
|
2
2
|
export declare class ICPBlockExplorer implements AirGapBlockExplorer {
|
|
3
3
|
readonly url: string;
|
|
4
|
-
constructor(url
|
|
4
|
+
constructor(url?: string);
|
|
5
5
|
private readonly metadata;
|
|
6
6
|
getMetadata(): Promise<BlockExplorerMetadata>;
|
|
7
7
|
createAddressUrl(address: string): Promise<string>;
|
|
@@ -8,65 +8,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.ICPBlockExplorer = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
const BLOCK_EXPLORER_URL = 'https://dashboard.internetcomputer.org/';
|
|
14
|
+
class ICPBlockExplorer {
|
|
15
|
+
constructor(url = BLOCK_EXPLORER_URL) {
|
|
42
16
|
this.url = url;
|
|
43
17
|
this.metadata = {
|
|
44
18
|
name: 'ICP Explorer',
|
|
45
19
|
url: this.url
|
|
46
20
|
};
|
|
47
21
|
}
|
|
48
|
-
|
|
49
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
return
|
|
51
|
-
return [2 /*return*/, this.metadata];
|
|
52
|
-
});
|
|
22
|
+
getMetadata() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return this.metadata;
|
|
53
25
|
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
return
|
|
58
|
-
return [2 /*return*/, "".concat(this.url, "/account/").concat(address)];
|
|
59
|
-
});
|
|
26
|
+
}
|
|
27
|
+
createAddressUrl(address) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return `${this.url}/account/${address}`;
|
|
60
30
|
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
return
|
|
65
|
-
return [2 /*return*/, "".concat(this.url, "/transaction/").concat(transactionId)];
|
|
66
|
-
});
|
|
31
|
+
}
|
|
32
|
+
createTransactionUrl(transactionId) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return `${this.url}/transaction/${transactionId}`;
|
|
67
35
|
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
71
38
|
exports.ICPBlockExplorer = ICPBlockExplorer;
|
|
72
39
|
//# sourceMappingURL=ICPBlockExplorer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICPBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/ICPBlockExplorer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ICPBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/ICPBlockExplorer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAM,kBAAkB,GAAW,yCAAyC,CAAA;AAE5E,MAAa,gBAAgB;IAC3B,YAAmC,MAAc,kBAAkB;QAAhC,QAAG,GAAH,GAAG,CAA6B;QAElD,aAAQ,GAA0B;YACjD,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IALqE,CAAC;IAO1D,WAAW;;YACtB,OAAO,IAAI,CAAC,QAAQ,CAAA;QACtB,CAAC;KAAA;IAEY,gBAAgB,CAAC,OAAe;;YAC3C,OAAO,GAAG,IAAI,CAAC,GAAG,YAAY,OAAO,EAAE,CAAA;QACzC,CAAC;KAAA;IACY,oBAAoB,CAAC,aAAqB;;YACrD,OAAO,GAAG,IAAI,CAAC,GAAG,gBAAgB,aAAa,EAAE,CAAA;QACnD,CAAC;KAAA;CACF;AAlBD,4CAkBC"}
|
package/v1/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ import { ICPTransactionSignRequest } from './serializer/v3/schemas/definitions/t
|
|
|
6
6
|
import { ICPTransactionSignResponse } from './serializer/v3/schemas/definitions/transaction-sign-response-icp';
|
|
7
7
|
import { ICPCryptoConfiguration } from './types/crypto';
|
|
8
8
|
import { ICPProtocolNetwork, ICPProtocolOptions, ICPUnits } from './types/protocol';
|
|
9
|
-
import { ICPSignedTransaction, ICPUnsignedTransaction } from './types/transaction';
|
|
9
|
+
import { ICPActionType, ICPSignedTransaction, ICPUnsignedTransaction } from './types/transaction';
|
|
10
10
|
export { ICPModule };
|
|
11
11
|
export { ICPProtocol, createICPProtocol, createICPProtocolOptions, CkBTCOfflineProtocol, CkBTCOnlineProtocol, createCkBTCOfflineProtocol, createCkBTCOnlineProtocol };
|
|
12
12
|
export { ICPBlockExplorer };
|
|
13
|
-
export { ICPCryptoConfiguration, ICPUnits, ICPProtocolOptions, ICPProtocolNetwork, ICPUnsignedTransaction, ICPSignedTransaction };
|
|
13
|
+
export { ICPCryptoConfiguration, ICPUnits, ICPProtocolOptions, ICPProtocolNetwork, ICPUnsignedTransaction, ICPSignedTransaction, ICPActionType };
|
|
14
14
|
export { ICPTransactionSignRequest, ICPTransactionSignResponse };
|
package/v1/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ICPBlockExplorer = exports.createCkBTCOnlineProtocol = exports.createCkBTCOfflineProtocol = exports.createICPProtocolOptions = exports.createICPProtocol = exports.ICPModule = void 0;
|
|
4
|
-
|
|
3
|
+
exports.ICPActionType = exports.ICPBlockExplorer = exports.createCkBTCOnlineProtocol = exports.createCkBTCOfflineProtocol = exports.createICPProtocolOptions = exports.createICPProtocol = exports.ICPModule = void 0;
|
|
4
|
+
const ICPBlockExplorer_1 = require("./block-explorer/ICPBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "ICPBlockExplorer", { enumerable: true, get: function () { return ICPBlockExplorer_1.ICPBlockExplorer; } });
|
|
6
|
-
|
|
6
|
+
const ICPModule_1 = require("./module/ICPModule");
|
|
7
7
|
Object.defineProperty(exports, "ICPModule", { enumerable: true, get: function () { return ICPModule_1.ICPModule; } });
|
|
8
|
-
|
|
8
|
+
const 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
|
-
|
|
11
|
+
const CkBTCProtocol_1 = require("./protocol/icrc/CkBTCProtocol");
|
|
12
12
|
Object.defineProperty(exports, "createCkBTCOfflineProtocol", { enumerable: true, get: function () { return CkBTCProtocol_1.createCkBTCOfflineProtocol; } });
|
|
13
13
|
Object.defineProperty(exports, "createCkBTCOnlineProtocol", { enumerable: true, get: function () { return CkBTCProtocol_1.createCkBTCOnlineProtocol; } });
|
|
14
|
+
const transaction_1 = require("./types/transaction");
|
|
15
|
+
Object.defineProperty(exports, "ICPActionType", { enumerable: true, get: function () { return transaction_1.ICPActionType; } });
|
|
14
16
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,wEAAoE;AAiC3D,iGAjCA,mCAAgB,OAiCA;AAhCzB,kDAA8C;AAgBrC,0FAhBA,qBAAS,OAgBA;AAflB,wDAAiG;AAqB/F,kGArBO,+BAAiB,OAqBP;AACjB,yGAtB0B,sCAAwB,OAsB1B;AArB1B,iEAKsC;AAmBpC,2GArBA,0CAA0B,OAqBA;AAC1B,0GArBA,yCAAyB,OAqBA;AAf3B,qDAAiG;AA+B/F,8FA/BO,2BAAa,OA+BP"}
|
package/v1/module/ICPModule.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
2
|
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
3
|
-
import { ICPProtocolNetwork } from '../types/protocol';
|
|
4
3
|
declare type SupportedProtocols = MainProtocolSymbols.ICP | MainProtocolSymbols.ICP_CKBTC;
|
|
5
4
|
export declare class ICPModule implements AirGapModule<{
|
|
6
5
|
Protocols: SupportedProtocols;
|
|
7
|
-
ProtocolNetwork: ICPProtocolNetwork;
|
|
8
6
|
}> {
|
|
9
7
|
private readonly networkRegistries;
|
|
10
8
|
readonly supportedProtocols: Record<SupportedProtocols, ProtocolConfiguration>;
|
|
11
9
|
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
12
10
|
createOfflineProtocol(identifier: SupportedProtocols): Promise<AirGapOfflineProtocol | undefined>;
|
|
13
|
-
createOnlineProtocol(identifier: SupportedProtocols,
|
|
14
|
-
createBlockExplorer(identifier: SupportedProtocols,
|
|
11
|
+
createOnlineProtocol(identifier: SupportedProtocols, networkId?: string): Promise<AirGapOnlineProtocol | undefined>;
|
|
12
|
+
createBlockExplorer(identifier: SupportedProtocols, networkId?: string): Promise<AirGapBlockExplorer | undefined>;
|
|
15
13
|
}
|
|
16
14
|
export {};
|
package/v1/module/ICPModule.js
CHANGED
|
@@ -8,112 +8,71 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.ICPModule = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_a[coinlib_core_1.MainProtocolSymbols.ICP] = new module_kit_1.ModuleNetworkRegistry({
|
|
13
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
14
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
15
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
16
|
+
const ICPBlockExplorer_1 = require("../block-explorer/ICPBlockExplorer");
|
|
17
|
+
const ICPProtocol_1 = require("../protocol/ICPProtocol");
|
|
18
|
+
const CkBTCProtocol_1 = require("../protocol/icrc/CkBTCProtocol");
|
|
19
|
+
const serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
20
|
+
class ICPModule {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.networkRegistries = {
|
|
23
|
+
[coinlib_core_1.MainProtocolSymbols.ICP]: new module_kit_1.ModuleNetworkRegistry({
|
|
52
24
|
supportedNetworks: [ICPProtocol_1.ICP_MAINNET_PROTOCOL_NETWORK]
|
|
53
25
|
}),
|
|
54
|
-
|
|
26
|
+
[coinlib_core_1.MainProtocolSymbols.ICP_CKBTC]: new module_kit_1.ModuleNetworkRegistry({
|
|
55
27
|
supportedNetworks: [CkBTCProtocol_1.CKBTC_MAINNET_PROTOCOL_NETWORK]
|
|
56
|
-
})
|
|
57
|
-
|
|
28
|
+
})
|
|
29
|
+
};
|
|
58
30
|
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
59
31
|
}
|
|
60
|
-
|
|
61
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
return
|
|
63
|
-
return [2 /*return*/, new serializer_companion_1.ICPV3SerializerCompanion()];
|
|
64
|
-
});
|
|
32
|
+
createV3SerializerCompanion() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return new serializer_companion_1.ICPV3SerializerCompanion();
|
|
65
35
|
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
return [2 /*return*/];
|
|
79
|
-
});
|
|
36
|
+
}
|
|
37
|
+
createOfflineProtocol(identifier) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
switch (identifier) {
|
|
40
|
+
case coinlib_core_1.MainProtocolSymbols.ICP:
|
|
41
|
+
return (0, ICPProtocol_1.createICPProtocol)();
|
|
42
|
+
case coinlib_core_1.MainProtocolSymbols.ICP_CKBTC:
|
|
43
|
+
return (0, CkBTCProtocol_1.createCkBTCOfflineProtocol)();
|
|
44
|
+
default:
|
|
45
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, `Protocol ${identifier} not supported.`);
|
|
46
|
+
}
|
|
80
47
|
});
|
|
81
|
-
}
|
|
82
|
-
|
|
48
|
+
}
|
|
49
|
+
createOnlineProtocol(identifier, networkId) {
|
|
83
50
|
var _a;
|
|
84
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, "Protocol ".concat(identifier, " not supported."));
|
|
98
|
-
}
|
|
99
|
-
return [2 /*return*/];
|
|
100
|
-
});
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
53
|
+
if (network === undefined) {
|
|
54
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, 'Protocol network not supported.');
|
|
55
|
+
}
|
|
56
|
+
switch (identifier) {
|
|
57
|
+
case coinlib_core_1.MainProtocolSymbols.ICP:
|
|
58
|
+
return (0, ICPProtocol_1.createICPProtocol)({ network });
|
|
59
|
+
case coinlib_core_1.MainProtocolSymbols.ICP_CKBTC:
|
|
60
|
+
return (0, CkBTCProtocol_1.createCkBTCOnlineProtocol)({ network });
|
|
61
|
+
default:
|
|
62
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, `Protocol ${identifier} not supported.`);
|
|
63
|
+
}
|
|
101
64
|
});
|
|
102
|
-
}
|
|
103
|
-
|
|
65
|
+
}
|
|
66
|
+
createBlockExplorer(identifier, networkId) {
|
|
104
67
|
var _a;
|
|
105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
return [2 /*return*/, new ICPBlockExplorer_1.ICPBlockExplorer(network.blockExplorerUrl)];
|
|
113
|
-
});
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
70
|
+
if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
|
|
71
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.ICP, 'Block Explorer network not supported.');
|
|
72
|
+
}
|
|
73
|
+
return new ICPBlockExplorer_1.ICPBlockExplorer();
|
|
114
74
|
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
}());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
118
77
|
exports.ICPModule = ICPModule;
|
|
119
78
|
//# sourceMappingURL=ICPModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICPModule.js","sourceRoot":"","sources":["../../../src/v1/module/ICPModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ICPModule.js","sourceRoot":"","sources":["../../../src/v1/module/ICPModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAkE;AAClE,wDAAqE;AACrE,mDAU2B;AAE3B,yEAAqE;AACrE,yDAAyF;AACzF,kEAAsI;AACtI,gFAAgF;AAIhF,MAAa,SAAS;IAAtB;QACmB,sBAAiB,GAAsD;YACtF,CAAC,kCAAmB,CAAC,GAAG,CAAC,EAAE,IAAI,kCAAqB,CAAC;gBACnD,iBAAiB,EAAE,CAAC,0CAA4B,CAAC;aAClD,CAAC;YACF,CAAC,kCAAmB,CAAC,SAAS,CAAC,EAAE,IAAI,kCAAqB,CAAC;gBACzD,iBAAiB,EAAE,CAAC,8CAA8B,CAAC;aACpD,CAAC;SACH,CAAA;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAyC1I,CAAC;IAvCc,2BAA2B;;YACtC,OAAO,IAAI,+CAAwB,EAAE,CAAA;QACvC,CAAC;KAAA;IAEY,qBAAqB,CAAC,UAA8B;;YAC/D,QAAQ,UAAU,EAAE;gBAClB,KAAK,kCAAmB,CAAC,GAAG;oBAC1B,OAAO,IAAA,+BAAiB,GAAE,CAAA;gBAC5B,KAAK,kCAAmB,CAAC,SAAS;oBAChC,OAAO,IAAA,0CAA0B,GAAE,CAAA;gBACrC;oBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,GAAG,EAAE,YAAY,UAAU,iBAAiB,CAAC,CAAA;aACzF;QACH,CAAC;KAAA;IAEY,oBAAoB,CAAC,UAA8B,EAAE,SAAkB;;;YAClF,MAAM,OAAO,GAAgC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;YACvG,IAAI,OAAO,KAAK,SAAS,EAAE;gBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,GAAG,EAAE,iCAAiC,CAAC,CAAA;aACjF;YAED,QAAQ,UAAU,EAAE;gBAClB,KAAK,kCAAmB,CAAC,GAAG;oBAC1B,OAAO,IAAA,+BAAiB,EAAC,EAAE,OAAO,EAAE,CAAC,CAAA;gBACvC,KAAK,kCAAmB,CAAC,SAAS;oBAChC,OAAO,IAAA,yCAAyB,EAAC,EAAE,OAAO,EAAE,CAAC,CAAA;gBAC/C;oBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,GAAG,EAAE,YAAY,UAAU,iBAAiB,CAAC,CAAA;aACzF;;KACF;IAEY,mBAAmB,CAAC,UAA8B,EAAE,SAAkB;;;YACjF,MAAM,OAAO,GAAgC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;YACvG,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,SAAS,EAAE;gBAC/B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,GAAG,EAAE,uCAAuC,CAAC,CAAA;aACvF;YAED,OAAO,IAAI,mCAAgB,EAAE,CAAA;;KAC9B;CACF;AAlDD,8BAkDC"}
|
package/v1/module.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.create = void 0;
|
|
18
|
-
|
|
18
|
+
const ICPModule_1 = require("./module/ICPModule");
|
|
19
19
|
__exportStar(require("./index"), exports);
|
|
20
20
|
function create() {
|
|
21
21
|
return new ICPModule_1.ICPModule();
|
package/v1/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,kDAA8C;AAE9C,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,qBAAS,EAAE,CAAA;AACxB,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AirGapTransaction } from '@airgap/module-kit';
|
|
2
|
+
import { ICPProtocolNetwork, ICPUnits, ICPUnsignedTransaction } from '../module';
|
|
3
|
+
export declare function createUnsignedTransactionGetNeuronInfo(): Promise<ICPUnsignedTransaction>;
|
|
4
|
+
export declare function getDetailsFromUnsignedTransactionGetNeuronInfo(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
5
|
+
export declare function signTransactionGetNeuronInfo(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
6
|
+
export declare function getDetailsFromSignedTransactionGetNeuronInfo(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
7
|
+
export declare function createUnsignedTransactionTransferToSubaccount(publicKey: string, canisterId: string, amount: bigint, fee: bigint): Promise<ICPUnsignedTransaction>;
|
|
8
|
+
export declare function getDetailsFromUnsignedTransactionTransferToSubaccount(unsignedTransaction: string, publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
9
|
+
export declare function signTransactionTransferToSubaccount(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
10
|
+
export declare function getDetailsFromSignedTransactionTransferToSubaccount(signedTransaction: string, publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
11
|
+
export declare function createUnsignedTransactionClaimGovernance(publicKey: string): Promise<ICPUnsignedTransaction>;
|
|
12
|
+
export declare function getDetailsFromUnsignedTransactionClaimGovernance(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
13
|
+
export declare function signTransactionClaimGovernance(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
14
|
+
export declare function getDetailsFromSignedTransactionClaimGovernance(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
15
|
+
export declare function createUnsignedTransactionIncreaseDelay(publicKey: string, delaySeconds: number): Promise<ICPUnsignedTransaction>;
|
|
16
|
+
export declare function getDetailsFromUnsignedTransactionIncreaseDelay(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
17
|
+
export declare function signTransactionIncreaseDelay(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
18
|
+
export declare function getDetailsFromSignedTransactionIncreaseDelay(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
19
|
+
export declare function createUnsignedTransactionStartDissolving(publicKey: string): Promise<ICPUnsignedTransaction>;
|
|
20
|
+
export declare function getDetailsFromUnsignedTransactionStartDissolving(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
21
|
+
export declare function signTransactionStartDissolving(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
22
|
+
export declare function getDetailsFromSignedTransactionStartDissolving(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
23
|
+
export declare function createUnsignedTransactionStopDissolving(publicKey: string): Promise<ICPUnsignedTransaction>;
|
|
24
|
+
export declare function getDetailsFromUnsignedTransactionStopDissolving(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
25
|
+
export declare function signTransactionStopDissolving(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
26
|
+
export declare function getDetailsFromSignedTransactionStopDissolving(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
27
|
+
export declare function createUnsignedTransactionFollowNeuron(publicKey: string, neuronId: number): Promise<ICPUnsignedTransaction>;
|
|
28
|
+
export declare function getDetailsFromUnsignedTransactionFollowNeuron(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
29
|
+
export declare function signTransactionFollowNeuron(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
30
|
+
export declare function getDetailsFromSignedTransactionFollowNeuron(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
31
|
+
export declare function createUnsignedTransactionRestakeMaturity(publicKey: string, percentageStake: number): Promise<ICPUnsignedTransaction>;
|
|
32
|
+
export declare function getDetailsFromUnsignedTransactionRestakeMaturity(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
33
|
+
export declare function signTransactionRestakeMaturity(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
34
|
+
export declare function getDetailsFromSignedTransactionRestakeMaturity(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
35
|
+
export declare function createUnsignedTransactionRemoveStake(publicKey: string): Promise<ICPUnsignedTransaction>;
|
|
36
|
+
export declare function getDetailsFromUnsignedTransactionRemoveStake(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|
|
37
|
+
export declare function signTransactionRemoveStake(unsignedTransaction: string, privateKey: string, canisterId: string): Promise<string>;
|
|
38
|
+
export declare function getDetailsFromSignedTransactionRemoveStake(publicKey: string, network: ICPProtocolNetwork): AirGapTransaction<ICPUnits>[];
|