@airgap/icp 0.13.15-beta.1 → 0.13.15-beta.11
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 +3 -2
- package/v1/index.js +9 -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 +39 -0
- package/v1/protocol/ICPGovernance.js +1177 -0
- package/v1/protocol/ICPGovernance.js.map +1 -0
- package/v1/protocol/ICPImplementation.d.ts +30 -5
- package/v1/protocol/ICPImplementation.js +317 -252
- package/v1/protocol/ICPImplementation.js.map +1 -1
- package/v1/protocol/ICPProtocol.d.ts +60 -8
- package/v1/protocol/ICPProtocol.js +765 -320
- 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 +48 -5
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-icp.d.ts +8 -2
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-icp.json +31 -1
- package/v1/serializer/v3/serializer-companion.js +85 -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 +29 -0
- package/v1/types/governance.js +279 -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 +22 -3
- package/v1/types/transaction.js +38 -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/json.d.ts +1 -0
- package/v1/utils/json.js +19 -0
- package/v1/utils/json.js.map +1 -0
- 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
|
@@ -8,43 +8,16 @@ 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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
13
|
};
|
|
41
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
15
|
exports.icpValidators = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
16
|
+
const base64Check_1 = __importDefault(require("@airgap/coinlib-core/utils/base64Check"));
|
|
17
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
18
|
+
const ICPProtocol_1 = require("../../../protocol/ICPProtocol");
|
|
46
19
|
exports.icpValidators = {
|
|
47
|
-
isMainNet:
|
|
20
|
+
isMainNet: (value) => {
|
|
48
21
|
// allow empty values by default (needs to be checked by "presence" check)
|
|
49
22
|
if (value === null || typeof value === 'undefined') {
|
|
50
23
|
return null;
|
|
@@ -54,7 +27,7 @@ exports.icpValidators = {
|
|
|
54
27
|
}
|
|
55
28
|
return null;
|
|
56
29
|
},
|
|
57
|
-
isValidICPTx:
|
|
30
|
+
isValidICPTx: (transaction) => {
|
|
58
31
|
// allow empty values by default (needs to be checked by "presence" check)
|
|
59
32
|
if (transaction === null || typeof transaction === 'undefined') {
|
|
60
33
|
return null;
|
|
@@ -75,32 +48,20 @@ exports.icpValidators = {
|
|
|
75
48
|
return "isn't a string";
|
|
76
49
|
}
|
|
77
50
|
},
|
|
78
|
-
isValidICPAccount:
|
|
79
|
-
return new Promise(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
case 2:
|
|
93
|
-
_a.sent();
|
|
94
|
-
resolve();
|
|
95
|
-
return [3 /*break*/, 4];
|
|
96
|
-
case 3:
|
|
97
|
-
error_1 = _a.sent();
|
|
98
|
-
reject('not a valid ICP account');
|
|
99
|
-
return [3 /*break*/, 4];
|
|
100
|
-
case 4: return [2 /*return*/];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}); });
|
|
51
|
+
isValidICPAccount: (accountIdentifier) => {
|
|
52
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
if (accountIdentifier === null || typeof accountIdentifier === 'undefined') {
|
|
54
|
+
reject();
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const protocol = (0, ICPProtocol_1.createICPProtocol)();
|
|
58
|
+
yield protocol.getTransactionsForPublicKey((0, module_kit_1.newPublicKey)(accountIdentifier, 'hex'), 1);
|
|
59
|
+
resolve();
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
reject('not a valid ICP account');
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
104
65
|
}
|
|
105
66
|
};
|
|
106
67
|
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yFAA8D;AAC9D,mDAAiD;AAEjD,+DAAiE;AAEpD,QAAA,aAAa,GAAG;IAC3B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CAAA;aACV;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,yBAAyB,CAAC,CAAA;aAClC;QACH,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
package/v1/types/governance.d.ts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { Principal } from '../utils/principal';
|
|
2
|
+
import * as IDL from '../utils/idl';
|
|
3
|
+
import { DelegateeDetails, DelegationDetails, DelegatorDetails } from '@airgap/coinlib-core';
|
|
4
|
+
export declare enum ICPStakingActionType {
|
|
5
|
+
GET_STAKING_DETAILS = "GET_STAKING_DETAILS",
|
|
6
|
+
STAKE_AND_FOLLOW = "STAKE_AND_FOLLOW",
|
|
7
|
+
FOLLOW = "FOLLOW",
|
|
8
|
+
REFRESH_NEURON = "REFRESH_NEURON",
|
|
9
|
+
INCREASE_DISSOLVE_DELAY = "INCREASE_DISSOLVE_DELAY",
|
|
10
|
+
START_DISSOLVING = "START_DISSOLVING",
|
|
11
|
+
STOP_DISSOLVING = "STOP_DISSOLVING",
|
|
12
|
+
DISBURSE_AND_UNFOLLOW = "DISBURSE_AND_UNFOLLOW"
|
|
13
|
+
}
|
|
14
|
+
export interface ICPDelegatorDetails extends DelegatorDetails {
|
|
15
|
+
subaccountBalance: string;
|
|
16
|
+
stake?: string;
|
|
17
|
+
votingPower?: string;
|
|
18
|
+
age?: string;
|
|
19
|
+
dissolveDelay?: string;
|
|
20
|
+
maturity?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ICPDelegateeDetails extends DelegateeDetails {
|
|
23
|
+
status: 'unknown' | 'followed' | 'not-followed';
|
|
24
|
+
votingPower: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ICPDelegationDetails extends DelegationDetails {
|
|
27
|
+
delegator: ICPDelegatorDetails;
|
|
28
|
+
delegatees: ICPDelegateeDetails[];
|
|
29
|
+
}
|
|
2
30
|
export interface AccountIdentifier {
|
|
3
31
|
hash: Uint8Array;
|
|
4
32
|
}
|
|
@@ -578,3 +606,4 @@ export declare const idlFactory: ({ IDL }: {
|
|
|
578
606
|
export declare const init: ({ IDL }: {
|
|
579
607
|
IDL: any;
|
|
580
608
|
}) => any[];
|
|
609
|
+
export declare const ListNeurons: IDL.RecordClass;
|