@airgap/module-kit 0.13.45-beta.2 → 0.13.45-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/block-explorer/block-explorer.d.ts +1 -1
- package/factories/amount.js +4 -5
- package/factories/amount.js.map +1 -1
- package/factories/key.js +12 -17
- package/factories/key.js.map +1 -1
- package/factories/signature.js +3 -5
- package/factories/signature.js.map +1 -1
- package/factories/transaction.js +4 -16
- package/factories/transaction.js.map +1 -1
- package/factories/ui/alert.js +8 -20
- package/factories/ui/alert.js.map +1 -1
- package/factories/ui/text.js +1 -2
- package/factories/ui/text.js.map +1 -1
- package/index.js +13 -13
- package/index.js.map +1 -1
- package/internal/index.js +1 -1
- package/internal/index.js.map +1 -1
- package/internal/utils/protocol.js +3 -3
- package/internal/utils/protocol.js.map +1 -1
- package/module/extensions/extensions.d.ts +1 -1
- package/module/extensions/serialization/ProtocolSerializer.d.ts +2 -2
- package/module/module-network-registry.js +10 -13
- package/module/module-network-registry.js.map +1 -1
- package/module/module.d.ts +4 -4
- package/package.json +3 -3
- package/protocol/extensions/address/FetchDataForAddressExtension.d.ts +1 -1
- package/protocol/extensions/address/FetchDataForMultipleAddressesExtension.d.ts +1 -1
- package/protocol/extensions/address/MultiAddressPublicKeyExtension.d.ts +1 -1
- package/protocol/extensions/bip/Bip32Extension.d.ts +3 -3
- package/protocol/extensions/contract/ConfigurableContractExtension.d.ts +1 -1
- package/protocol/extensions/crypto/AESExtension.d.ts +1 -1
- package/protocol/extensions/crypto/AsymmetricEncryptionExtension.d.ts +1 -1
- package/protocol/extensions/crypto/CryptoExtension.d.ts +1 -1
- package/protocol/extensions/crypto/SignMessageExtension.d.ts +1 -1
- package/protocol/extensions/dapp/WalletConnectProtocol.d.ts +2 -2
- package/protocol/extensions/extensions.d.ts +1 -1
- package/protocol/extensions/multisig/multisig.d.ts +1 -1
- package/protocol/extensions/sub-protocol/GetTokenBalancesExtension.d.ts +2 -2
- package/protocol/extensions/sub-protocol/MultiTokenSubProtocolExtension.d.ts +1 -1
- package/protocol/extensions/sub-protocol/SingleTokenSubProtocolExtension.d.ts +1 -1
- package/protocol/extensions/sub-protocol/SubProtocolExtension.d.ts +1 -1
- package/protocol/extensions/transaction/ConfigurableTransactionInjectorExtension.d.ts +1 -1
- package/protocol/extensions/transaction/TransactionStatusCheckerExtension.d.ts +1 -1
- package/protocol/protocol.d.ts +20 -20
- package/types/address.d.ts +1 -1
- package/types/airgap.d.ts +7 -7
- package/types/amount.js +18 -23
- package/types/amount.js.map +1 -1
- package/types/bytes.d.ts +1 -1
- package/types/crypto.d.ts +3 -3
- package/types/fee.d.ts +1 -1
- package/types/key.d.ts +3 -3
- package/types/meta/utility-types.d.ts +6 -6
- package/types/module.d.ts +1 -1
- package/types/protocol.d.ts +2 -2
- package/types/sub-protocol.d.ts +1 -1
- package/types/transaction.d.ts +2 -2
- package/types/ui/text.d.ts +2 -2
- package/utils/amount.js +3 -4
- package/utils/amount.js.map +1 -1
- package/utils/interface.d.ts +1 -1
- package/utils/interface.js +2 -3
- package/utils/interface.js.map +1 -1
- package/utils/key.d.ts +1 -1
- package/utils/key.js +6 -7
- package/utils/key.js.map +1 -1
- package/utils/module.js +14 -16
- package/utils/module.js.map +1 -1
- package/utils/normalize.js +1 -2
- package/utils/normalize.js.map +1 -1
- package/utils/protocol.js +81 -55
- package/utils/protocol.js.map +1 -1
|
@@ -5,4 +5,4 @@ export interface BlockExplorer {
|
|
|
5
5
|
createAddressUrl(address: string): Promise<string>;
|
|
6
6
|
createTransactionUrl(transactionId: string): Promise<string>;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type AirGapBlockExplorer = AirGapInterface<BlockExplorer>;
|
package/factories/amount.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newAmount =
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
exports.newAmount = newAmount;
|
|
4
|
+
const amount_1 = require("../types/amount");
|
|
5
|
+
const amount_2 = require("../utils/amount");
|
|
6
6
|
function newAmount(amount, unitOrUndefined) {
|
|
7
7
|
if ((0, amount_2.isAmount)(amount)) {
|
|
8
8
|
return new amount_1.AmountEnhanced(amount.value, amount.unit);
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
|
-
|
|
11
|
+
const unit = unitOrUndefined;
|
|
12
12
|
return new amount_1.AmountEnhanced(amount, unit);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
exports.newAmount = newAmount;
|
|
16
15
|
//# sourceMappingURL=amount.js.map
|
package/factories/amount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/factories/amount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/factories/amount.ts"],"names":[],"mappings":";;AAOA,8BAWC;AAhBD,4CAAwD;AACxD,4CAA0C;AAI1C,SAAgB,SAAS,CACvB,MAAoD,EACpD,eAAwC;IAExC,IAAI,IAAA,iBAAQ,EAAS,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,uBAAc,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IACtD,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,GAA2B,eAAgB,CAAA;QAErD,OAAO,IAAI,uBAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACzC,CAAC;AACH,CAAC"}
|
package/factories/key.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newExtendedPublicKey = exports.newPublicKey = exports.newExtendedSecretKey = exports.newSecretKey = void 0;
|
|
4
|
-
function newSecretKey(value, format) {
|
|
5
|
-
if (format === void 0) { format = 'encoded'; }
|
|
6
|
-
return { type: 'priv', value: value, format: format };
|
|
7
|
-
}
|
|
8
3
|
exports.newSecretKey = newSecretKey;
|
|
9
|
-
function newExtendedSecretKey(value, format) {
|
|
10
|
-
if (format === void 0) { format = 'encoded'; }
|
|
11
|
-
return { type: 'xpriv', value: value, format: format };
|
|
12
|
-
}
|
|
13
4
|
exports.newExtendedSecretKey = newExtendedSecretKey;
|
|
14
|
-
function newPublicKey(value, format) {
|
|
15
|
-
if (format === void 0) { format = 'encoded'; }
|
|
16
|
-
return { type: 'pub', value: value, format: format };
|
|
17
|
-
}
|
|
18
5
|
exports.newPublicKey = newPublicKey;
|
|
19
|
-
function newExtendedPublicKey(value, format) {
|
|
20
|
-
if (format === void 0) { format = 'encoded'; }
|
|
21
|
-
return { type: 'xpub', value: value, format: format };
|
|
22
|
-
}
|
|
23
6
|
exports.newExtendedPublicKey = newExtendedPublicKey;
|
|
7
|
+
function newSecretKey(value, format = 'encoded') {
|
|
8
|
+
return { type: 'priv', value, format };
|
|
9
|
+
}
|
|
10
|
+
function newExtendedSecretKey(value, format = 'encoded') {
|
|
11
|
+
return { type: 'xpriv', value, format };
|
|
12
|
+
}
|
|
13
|
+
function newPublicKey(value, format = 'encoded') {
|
|
14
|
+
return { type: 'pub', value, format };
|
|
15
|
+
}
|
|
16
|
+
function newExtendedPublicKey(value, format = 'encoded') {
|
|
17
|
+
return { type: 'xpub', value, format };
|
|
18
|
+
}
|
|
24
19
|
//# sourceMappingURL=key.js.map
|
package/factories/key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../src/factories/key.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../src/factories/key.ts"],"names":[],"mappings":";;AAEA,oCAEC;AAED,oDAEC;AAED,oCAEC;AAED,oDAEC;AAdD,SAAgB,YAAY,CAAC,KAAa,EAAE,SAA8B,SAAS;IACjF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AACxC,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa,EAAE,SAAsC,SAAS;IACjG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AACzC,CAAC;AAED,SAAgB,YAAY,CAAC,KAAa,EAAE,SAA8B,SAAS;IACjF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AACvC,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa,EAAE,SAAsC,SAAS;IACjG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AACxC,CAAC"}
|
package/factories/signature.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newSignature = void 0;
|
|
4
|
-
function newSignature(value, format) {
|
|
5
|
-
if (format === void 0) { format = 'encoded'; }
|
|
6
|
-
return { value: value, format: format };
|
|
7
|
-
}
|
|
8
3
|
exports.newSignature = newSignature;
|
|
4
|
+
function newSignature(value, format = 'encoded') {
|
|
5
|
+
return { value, format };
|
|
6
|
+
}
|
|
9
7
|
//# sourceMappingURL=signature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/factories/signature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/factories/signature.ts"],"names":[],"mappings":";;AAEA,oCAEC;AAFD,SAAgB,YAAY,CAAC,KAAa,EAAE,SAA8B,SAAS;IACjF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC1B,CAAC"}
|
package/factories/transaction.js
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
3
|
+
exports.newUnsignedTransaction = newUnsignedTransaction;
|
|
4
|
+
exports.newSignedTransaction = newSignedTransaction;
|
|
15
5
|
function newUnsignedTransaction(transaction) {
|
|
16
|
-
return
|
|
6
|
+
return { ...transaction, type: 'unsigned' };
|
|
17
7
|
}
|
|
18
|
-
exports.newUnsignedTransaction = newUnsignedTransaction;
|
|
19
8
|
function newSignedTransaction(transaction) {
|
|
20
|
-
return
|
|
9
|
+
return { ...transaction, type: 'signed' };
|
|
21
10
|
}
|
|
22
|
-
exports.newSignedTransaction = newSignedTransaction;
|
|
23
11
|
//# sourceMappingURL=transaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/factories/transaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/factories/transaction.ts"],"names":[],"mappings":";;AAEA,wDAEC;AAED,oDAEC;AAND,SAAgB,sBAAsB,CAAgC,WAA4B;IAChG,OAAO,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,UAAU,EAAO,CAAA;AAClD,CAAC;AAED,SAAgB,oBAAoB,CAA8B,WAA4B;IAC5F,OAAO,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAO,CAAA;AAChD,CAAC"}
|
package/factories/ui/alert.js
CHANGED
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
3
|
+
exports.newSuccessUIAlert = newSuccessUIAlert;
|
|
4
|
+
exports.newInfoUIAlert = newInfoUIAlert;
|
|
5
|
+
exports.newWarningUIAlert = newWarningUIAlert;
|
|
6
|
+
exports.newErrorUIAlert = newErrorUIAlert;
|
|
15
7
|
function newSuccessUIAlert(alert) {
|
|
16
|
-
return
|
|
8
|
+
return { ...alert, type: 'success' };
|
|
17
9
|
}
|
|
18
|
-
exports.newSuccessUIAlert = newSuccessUIAlert;
|
|
19
10
|
function newInfoUIAlert(alert) {
|
|
20
|
-
return
|
|
11
|
+
return { ...alert, type: 'info' };
|
|
21
12
|
}
|
|
22
|
-
exports.newInfoUIAlert = newInfoUIAlert;
|
|
23
13
|
function newWarningUIAlert(alert) {
|
|
24
|
-
return
|
|
14
|
+
return { ...alert, type: 'warning' };
|
|
25
15
|
}
|
|
26
|
-
exports.newWarningUIAlert = newWarningUIAlert;
|
|
27
16
|
function newErrorUIAlert(alert) {
|
|
28
|
-
return
|
|
17
|
+
return { ...alert, type: 'error' };
|
|
29
18
|
}
|
|
30
|
-
exports.newErrorUIAlert = newErrorUIAlert;
|
|
31
19
|
//# sourceMappingURL=alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/factories/ui/alert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/factories/ui/alert.ts"],"names":[],"mappings":";;AAEA,8CAEC;AAED,wCAEC;AAED,8CAEC;AAED,0CAEC;AAdD,SAAgB,iBAAiB,CAAC,KAAkC;IAClE,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AACtC,CAAC;AAED,SAAgB,cAAc,CAAC,KAAkC;IAC/D,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AACnC,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAkC;IAClE,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AACtC,CAAC;AAED,SAAgB,eAAe,CAAC,KAAkC;IAChE,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AACpC,CAAC"}
|
package/factories/ui/text.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newPlainUIText =
|
|
3
|
+
exports.newPlainUIText = newPlainUIText;
|
|
4
4
|
function newPlainUIText(text) {
|
|
5
5
|
return { type: 'plain', value: text };
|
|
6
6
|
}
|
|
7
|
-
exports.newPlainUIText = newPlainUIText;
|
|
8
7
|
//# sourceMappingURL=text.js.map
|
package/factories/ui/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/factories/ui/text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/factories/ui/text.ts"],"names":[],"mappings":";;AAEA,wCAEC;AAFD,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACvC,CAAC"}
|
package/index.js
CHANGED
|
@@ -2,44 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bip32OfflineProtocolSchema = exports.bip32BaseProtocolSchema = exports.onlineProtocolSchema = exports.offlineProtocolSchema = exports.baseProtocolSchema = exports.protocolSerializerSchema = exports.normalizeToUndefined = exports.protocolNetworkIdentifier = exports.supportsWalletConnect = exports.isTransactionStatusChecker = exports.hasConfigurableTransactionInjector = exports.canSignMessage = exports.canEncryptAsymmetric = exports.canEncryptAES = exports.hasConfigurableContract = exports.hasMultiAddressPublicKeys = exports.canFetchDataForMultipleAddresses = exports.canFetchDataForAddress = exports.canGetTokenBalances = exports.isMultiTokenSubProtocol = exports.isMultisig = exports.isSingleTokenSubProtocol = exports.isSubProtocol = exports.isBip32Protocol = exports.isOnlineProtocol = exports.isOfflineProtocol = exports.isAnyProtocol = exports.canSerializeProtocols = exports.createSupportedProtocols = exports.isExtendedPublicKey = exports.isPublicKey = exports.isExtendedSecretKey = exports.isSecretKey = exports.isAnyKey = exports.implementsInterface = exports.isAmount = exports.ModuleNetworkRegistry = exports.newSignedTransaction = exports.newUnsignedTransaction = exports.newSignature = exports.newExtendedPublicKey = exports.newPublicKey = exports.newExtendedSecretKey = exports.newSecretKey = exports.newAmount = exports.newPlainUIText = exports.newErrorUIAlert = exports.newWarningUIAlert = exports.newInfoUIAlert = exports.newSuccessUIAlert = void 0;
|
|
4
4
|
exports.walletConnectProtocolSchema = exports.transactionStatusCheckerSchema = exports.configurableTransactionInjectorSchema = exports.signMessageOfflineSchema = exports.signMessageBaseSchema = exports.asymmetricEncryptionOfflineSchema = exports.asymmetricEncryptionBaseSchema = exports.aesEncryptionSchema = exports.configurableContractProtocolSchema = exports.multiAddressPublicKeyProtocolSchema = exports.fetchDataForMultipleAddressesProtocolSchema = exports.fetchDataForAddressProtocolSchema = exports.getTokenBalancesSchema = exports.multiTokenSubProtocolBaseSchema = exports.singleTokenSubProtocolSchema = exports.subProtocolSchema = exports.bip32OnlineProtocolSchema = void 0;
|
|
5
|
-
|
|
5
|
+
const amount_1 = require("./factories/amount");
|
|
6
6
|
Object.defineProperty(exports, "newAmount", { enumerable: true, get: function () { return amount_1.newAmount; } });
|
|
7
|
-
|
|
7
|
+
const key_1 = require("./factories/key");
|
|
8
8
|
Object.defineProperty(exports, "newExtendedPublicKey", { enumerable: true, get: function () { return key_1.newExtendedPublicKey; } });
|
|
9
9
|
Object.defineProperty(exports, "newExtendedSecretKey", { enumerable: true, get: function () { return key_1.newExtendedSecretKey; } });
|
|
10
10
|
Object.defineProperty(exports, "newPublicKey", { enumerable: true, get: function () { return key_1.newPublicKey; } });
|
|
11
11
|
Object.defineProperty(exports, "newSecretKey", { enumerable: true, get: function () { return key_1.newSecretKey; } });
|
|
12
|
-
|
|
12
|
+
const signature_1 = require("./factories/signature");
|
|
13
13
|
Object.defineProperty(exports, "newSignature", { enumerable: true, get: function () { return signature_1.newSignature; } });
|
|
14
|
-
|
|
14
|
+
const transaction_1 = require("./factories/transaction");
|
|
15
15
|
Object.defineProperty(exports, "newSignedTransaction", { enumerable: true, get: function () { return transaction_1.newSignedTransaction; } });
|
|
16
16
|
Object.defineProperty(exports, "newUnsignedTransaction", { enumerable: true, get: function () { return transaction_1.newUnsignedTransaction; } });
|
|
17
|
-
|
|
17
|
+
const alert_1 = require("./factories/ui/alert");
|
|
18
18
|
Object.defineProperty(exports, "newErrorUIAlert", { enumerable: true, get: function () { return alert_1.newErrorUIAlert; } });
|
|
19
19
|
Object.defineProperty(exports, "newInfoUIAlert", { enumerable: true, get: function () { return alert_1.newInfoUIAlert; } });
|
|
20
20
|
Object.defineProperty(exports, "newSuccessUIAlert", { enumerable: true, get: function () { return alert_1.newSuccessUIAlert; } });
|
|
21
21
|
Object.defineProperty(exports, "newWarningUIAlert", { enumerable: true, get: function () { return alert_1.newWarningUIAlert; } });
|
|
22
|
-
|
|
22
|
+
const text_1 = require("./factories/ui/text");
|
|
23
23
|
Object.defineProperty(exports, "newPlainUIText", { enumerable: true, get: function () { return text_1.newPlainUIText; } });
|
|
24
|
-
|
|
24
|
+
const module_network_registry_1 = require("./module/module-network-registry");
|
|
25
25
|
Object.defineProperty(exports, "ModuleNetworkRegistry", { enumerable: true, get: function () { return module_network_registry_1.ModuleNetworkRegistry; } });
|
|
26
|
-
|
|
26
|
+
const amount_2 = require("./utils/amount");
|
|
27
27
|
Object.defineProperty(exports, "isAmount", { enumerable: true, get: function () { return amount_2.isAmount; } });
|
|
28
|
-
|
|
28
|
+
const interface_1 = require("./utils/interface");
|
|
29
29
|
Object.defineProperty(exports, "implementsInterface", { enumerable: true, get: function () { return interface_1.implementsInterface; } });
|
|
30
|
-
|
|
30
|
+
const key_2 = require("./utils/key");
|
|
31
31
|
Object.defineProperty(exports, "isAnyKey", { enumerable: true, get: function () { return key_2.isAnyKey; } });
|
|
32
32
|
Object.defineProperty(exports, "isExtendedPublicKey", { enumerable: true, get: function () { return key_2.isExtendedPublicKey; } });
|
|
33
33
|
Object.defineProperty(exports, "isExtendedSecretKey", { enumerable: true, get: function () { return key_2.isExtendedSecretKey; } });
|
|
34
34
|
Object.defineProperty(exports, "isPublicKey", { enumerable: true, get: function () { return key_2.isPublicKey; } });
|
|
35
35
|
Object.defineProperty(exports, "isSecretKey", { enumerable: true, get: function () { return key_2.isSecretKey; } });
|
|
36
|
-
|
|
36
|
+
const module_1 = require("./utils/module");
|
|
37
37
|
Object.defineProperty(exports, "canSerializeProtocols", { enumerable: true, get: function () { return module_1.canSerializeProtocols; } });
|
|
38
38
|
Object.defineProperty(exports, "createSupportedProtocols", { enumerable: true, get: function () { return module_1.createSupportedProtocols; } });
|
|
39
39
|
Object.defineProperty(exports, "protocolSerializerSchema", { enumerable: true, get: function () { return module_1.protocolSerializerSchema; } });
|
|
40
|
-
|
|
40
|
+
const normalize_1 = require("./utils/normalize");
|
|
41
41
|
Object.defineProperty(exports, "normalizeToUndefined", { enumerable: true, get: function () { return normalize_1.normalizeToUndefined; } });
|
|
42
|
-
|
|
42
|
+
const protocol_1 = require("./utils/protocol");
|
|
43
43
|
Object.defineProperty(exports, "aesEncryptionSchema", { enumerable: true, get: function () { return protocol_1.aesEncryptionSchema; } });
|
|
44
44
|
Object.defineProperty(exports, "asymmetricEncryptionBaseSchema", { enumerable: true, get: function () { return protocol_1.asymmetricEncryptionBaseSchema; } });
|
|
45
45
|
Object.defineProperty(exports, "asymmetricEncryptionOfflineSchema", { enumerable: true, get: function () { return protocol_1.asymmetricEncryptionOfflineSchema; } });
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,+CAA8C;AAsJ5C,0FAtJO,kBAAS,OAsJP;AArJX,yCAAwG;AAyJtG,qGAzJO,0BAAoB,OAyJP;AAFpB,qGAvJ6B,0BAAoB,OAuJ7B;AACpB,6FAxJmD,kBAAY,OAwJnD;AAFZ,6FAtJiE,kBAAY,OAsJjE;AArJd,qDAAoD;AAyJlD,6FAzJO,wBAAY,OAyJP;AAxJd,yDAAsF;AA0JpF,qGA1JO,kCAAoB,OA0JP;AADpB,uGAzJ6B,oCAAsB,OAyJ7B;AAxJxB,gDAA4G;AAgJ1G,gGAhJO,uBAAe,OAgJP;AAFf,+FA9IwB,sBAAc,OA8IxB;AADd,kGA7IwC,yBAAiB,OA6IxC;AAEjB,kGA/I2D,yBAAiB,OA+I3D;AA9InB,8CAAoD;AAgJlD,+FAhJO,qBAAc,OAgJP;AAvIhB,8EAAwE;AAsJtE,sGAtJO,+CAAqB,OAsJP;AA5EvB,2CAAyC;AAsMvC,yFAtMO,iBAAQ,OAsMP;AArMV,iDAA+D;AAuM7D,oGAvMO,+BAAmB,OAuMP;AAtMrB,qCAA0G;AAuMxG,yFAvMO,cAAQ,OAuMP;AAIR,oGA3MiB,yBAAmB,OA2MjB;AAFnB,oGAzMsC,yBAAmB,OAyMtC;AACnB,4FA1M2D,iBAAW,OA0M3D;AAFX,4FAxMwE,iBAAW,OAwMxE;AAvMb,2CAA0G;AA4MxG,sGA5MO,8BAAqB,OA4MP;AADrB,yGA3M8B,iCAAwB,OA2M9B;AA4BxB,yGAvOwD,iCAAwB,OAuOxD;AAtO1B,iDAAwD;AAgOtD,qGAhOO,gCAAoB,OAgOP;AA/NtB,+CA2CyB;AAyMvB,oGAnPA,8BAAmB,OAmPA;AACnB,+GAnPA,yCAA8B,OAmPA;AAC9B,kHAnPA,4CAAiC,OAmPA;AAhBjC,mGAlOA,6BAAkB,OAkOA;AAGlB,wGApOA,kCAAuB,OAoOA;AACvB,2GApOA,qCAA0B,OAoOA;AAC1B,0GApOA,oCAAyB,OAoOA;AAnBzB,8FAhNA,wBAAa,OAgNA;AACb,qGAhNA,+BAAoB,OAgNA;AALpB,uGA1MA,iCAAsB,OA0MA;AACtB,iHA1MA,2CAAgC,OA0MA;AAFhC,oGAvMA,8BAAmB,OAuMA;AAOnB,+FA7MA,yBAAc,OA6MA;AAyBd,mHArOA,6CAAkC,OAqOA;AAMlC,sHA1OA,gDAAqC,OA0OA;AATrC,kHAhOA,4CAAiC,OAgOA;AACjC,4HAhOA,sDAA2C,OAgOA;AAF3C,uGA7NA,iCAAsB,OA6NA;AAxBtB,wGApMA,kCAAuB,OAoMA;AAIvB,mHAvMA,6CAAkC,OAuMA;AALlC,0GAjMA,oCAAyB,OAiMA;AAXzB,8FArLA,wBAAa,OAqLA;AAGb,gGAvLA,0BAAe,OAuLA;AAGf,2FAzLA,qBAAU,OAyLA;AACV,wGAzLA,kCAAuB,OAyLA;AANvB,kGAlLA,4BAAiB,OAkLA;AACjB,iGAlLA,2BAAgB,OAkLA;AAGhB,yGApLA,mCAAwB,OAoLA;AADxB,8FAlLA,wBAAa,OAkLA;AAab,2GA9LA,qCAA0B,OA8LA;AAsB1B,oHAnNA,8CAAmC,OAmNA;AAJnC,gHA9MA,0CAA+B,OA8MA;AAP/B,sGAtMA,gCAAqB,OAsMA;AACrB,qGAtMA,+BAAoB,OAsMA;AAVpB,0GA3LA,oCAAyB,OA2LA;AAyBzB,sGAnNA,gCAAqB,OAmNA;AACrB,yGAnNA,mCAAwB,OAmNA;AAXxB,6GAvMA,uCAA4B,OAuMA;AAD5B,kGArMA,4BAAiB,OAqMA;AAfjB,sGArLA,gCAAqB,OAqLA;AA6BrB,+GAjNA,yCAA8B,OAiNA;AAC9B,4GAjNA,sCAA2B,OAiNA"}
|
package/internal/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.delegateProtocolSchema = exports.supportsDelegation = void 0;
|
|
4
|
-
|
|
4
|
+
const protocol_1 = require("./utils/protocol");
|
|
5
5
|
Object.defineProperty(exports, "delegateProtocolSchema", { enumerable: true, get: function () { return protocol_1.delegateProtocolSchema; } });
|
|
6
6
|
Object.defineProperty(exports, "supportsDelegation", { enumerable: true, get: function () { return protocol_1.supportsDelegation; } });
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/internal/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;AACA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;AACA,+CAA6E;AAYpE,uGAZA,iCAAsB,OAYA;AAJtB,mGARwB,6BAAkB,OAQxB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Schemas
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
|
|
4
|
+
exports.delegateProtocolSchema = void 0;
|
|
5
|
+
exports.supportsDelegation = supportsDelegation;
|
|
6
|
+
const interface_1 = require("../../utils/interface");
|
|
6
7
|
exports.delegateProtocolSchema = {
|
|
7
8
|
getCurrentDelegateesForAddress: 'required',
|
|
8
9
|
getCurrentDelegateesForPublicKey: 'required',
|
|
@@ -20,5 +21,4 @@ exports.delegateProtocolSchema = {
|
|
|
20
21
|
function supportsDelegation(object) {
|
|
21
22
|
return (0, interface_1.implementsInterface)(object, exports.delegateProtocolSchema);
|
|
22
23
|
}
|
|
23
|
-
exports.supportsDelegation = supportsDelegation;
|
|
24
24
|
//# sourceMappingURL=protocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/internal/utils/protocol.ts"],"names":[],"mappings":";AAAA,UAAU;;;
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/internal/utils/protocol.ts"],"names":[],"mappings":";AAAA,UAAU;;;AAsBV,gDAEC;AArBD,qDAAmE;AAGtD,QAAA,sBAAsB,GAAmC;IACpE,8BAA8B,EAAE,UAAU;IAC1C,gCAAgC,EAAE,UAAU;IAC5C,mBAAmB,EAAE,UAAU;IAC/B,mBAAmB,EAAE,UAAU;IAC/B,+BAA+B,EAAE,UAAU;IAC3C,iCAAiC,EAAE,UAAU;IAC7C,8BAA8B,EAAE,UAAU;IAC1C,gCAAgC,EAAE,UAAU;IAC5C,mBAAmB,EAAE,UAAU;IAC/B,qBAAqB,EAAE,UAAU;IACjC,mCAAmC,EAAE,UAAU;CAChD,CAAA;AAED,wBAAwB;AAExB,SAAgB,kBAAkB,CAAC,MAAmB;IACpD,OAAO,IAAA,+BAAmB,EAAyB,MAAM,EAAE,8BAAsB,CAAC,CAAA;AACpF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module } from '../module';
|
|
2
2
|
import { ProtocolSerializerExtension } from './serialization/ProtocolSerializer';
|
|
3
|
-
export
|
|
3
|
+
export type ModuleExtensions<T> = T extends Module ? Extensions<T> : never;
|
|
4
4
|
interface Extensions<T extends Module> {
|
|
5
5
|
ProtocolSerializer: ProtocolSerializerExtension<T>;
|
|
6
6
|
}
|
|
@@ -8,8 +8,8 @@ export interface AirGapSerializedOfflineProtocol extends AirGapSerializedBasePro
|
|
|
8
8
|
}
|
|
9
9
|
export interface AirGapSerializedOnlineProtocol extends AirGapSerializedBaseProtocol<'online'> {
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type AirGapSerializedAnyProtocol = AirGapSerializedOfflineProtocol | AirGapSerializedOnlineProtocol;
|
|
12
|
+
export type ProtocolSerializerExtension<_T extends Module> = ProtocolSerializerModule;
|
|
13
13
|
export interface ProtocolSerializerModule {
|
|
14
14
|
serializeOfflineProtocol(protocol: AirGapOfflineProtocol): Promise<AirGapSerializedOfflineProtocol | undefined>;
|
|
15
15
|
deserializeOfflineProtocol(serialized: AirGapSerializedOfflineProtocol): Promise<AirGapOfflineProtocol | undefined>;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModuleNetworkRegistry = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _a;
|
|
10
|
-
return Object.assign(obj, (_a = {}, _a[(0, protocol_1.protocolNetworkIdentifier)(next)] = next, _a));
|
|
4
|
+
const protocol_1 = require("../utils/protocol");
|
|
5
|
+
class ModuleNetworkRegistry {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.supportedNetworks = options.supportedNetworks.reduce((obj, next) => {
|
|
8
|
+
return Object.assign(obj, { [(0, protocol_1.protocolNetworkIdentifier)(next)]: next });
|
|
11
9
|
}, {});
|
|
12
|
-
|
|
10
|
+
const defaultNetwork = options.defaultNetwork ?? options.supportedNetworks[0];
|
|
13
11
|
this.defaultNetworkId = defaultNetwork ? (0, protocol_1.protocolNetworkIdentifier)(defaultNetwork) : undefined;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
findNetwork(networkId) {
|
|
14
|
+
const targetNetworkId = networkId ?? this.defaultNetworkId;
|
|
17
15
|
return targetNetworkId ? this.supportedNetworks[targetNetworkId] : undefined;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}());
|
|
16
|
+
}
|
|
17
|
+
}
|
|
21
18
|
exports.ModuleNetworkRegistry = ModuleNetworkRegistry;
|
|
22
19
|
//# sourceMappingURL=module-network-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-network-registry.js","sourceRoot":"","sources":["../../src/module/module-network-registry.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"module-network-registry.js","sourceRoot":"","sources":["../../src/module/module-network-registry.ts"],"names":[],"mappings":";;;AACA,gDAA6D;AAE7D,MAAa,qBAAqB;IAIhC,YAAmB,OAAiD;QAClE,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAqC,EAAE,IAAsB,EAAE,EAAE;YAC1H,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,oCAAyB,EAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACxE,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,MAAM,cAAc,GAAiC,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAA;QAC3G,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC,CAAC,CAAC,IAAA,oCAAyB,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAChG,CAAC;IAEM,WAAW,CAAC,SAAkB;QACnC,MAAM,eAAe,GAAuB,SAAS,IAAI,IAAI,CAAC,gBAAgB,CAAA;QAE9E,OAAO,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC9E,CAAC;CACF;AAlBD,sDAkBC"}
|
package/module/module.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ interface ModuleGeneric<_Protocols extends string = string, _ProtocolNetwork ext
|
|
|
10
10
|
Protocols: _Protocols;
|
|
11
11
|
ProtocolNetwork: _ProtocolNetwork;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type TypedProtocols<G extends Partial<ModuleGeneric>> = Complement<ModuleGeneric, G>['Protocols'];
|
|
14
|
+
type TypedProtocolNetwork<G extends Partial<ModuleGeneric>> = Complement<ModuleGeneric, G>['ProtocolNetwork'];
|
|
15
15
|
interface _Module<_Protocols extends ModuleGeneric['Protocols'] = any, _ProtocolNetwork extends ModuleGeneric['ProtocolNetwork'] = any> {
|
|
16
16
|
supportedProtocols: Record<_Protocols, ProtocolConfiguration>;
|
|
17
17
|
createOfflineProtocol(identifier: _Protocols): Promise<AirGapOfflineProtocol | undefined>;
|
|
@@ -19,6 +19,6 @@ interface _Module<_Protocols extends ModuleGeneric['Protocols'] = any, _Protocol
|
|
|
19
19
|
createBlockExplorer(identifier: _Protocols, networkOrId?: _ProtocolNetwork | string): Promise<AirGapBlockExplorer | undefined>;
|
|
20
20
|
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
23
|
-
export
|
|
22
|
+
export type Module<G extends Partial<ModuleGeneric> = {}> = _Module<TypedProtocols<G>, TypedProtocolNetwork<G>>;
|
|
23
|
+
export type AirGapModule<G extends Partial<ModuleGeneric> = {}, E0 extends ApplicableModuleExtension<Module> = undefined, E1 extends ApplicableModuleExtension<Module> = undefined, E2 extends ApplicableModuleExtension<Module> = undefined, E3 extends ApplicableModuleExtension<Module> = undefined, E4 extends ApplicableModuleExtension<Module> = undefined, E5 extends ApplicableModuleExtension<Module> = undefined, E6 extends ApplicableModuleExtension<Module> = undefined, E7 extends ApplicableModuleExtension<Module> = undefined, E8 extends ApplicableModuleExtension<Module> = undefined, E9 extends ApplicableModuleExtension<Module> = undefined> = AirGapInterface<Module<G>, E0, E1, E2, E3, E4, E5, E6, E7, E8, E9>;
|
|
24
24
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/module-kit",
|
|
3
|
-
"version": "0.13.45-beta.
|
|
3
|
+
"version": "0.13.45-beta.3",
|
|
4
4
|
"description": "The @airgap/module-kit package provides the common interfaces and functionalities to implement AirGap modules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@airgap/coinlib-core": "^0.13.45-beta.
|
|
33
|
-
"@airgap/serializer": "^0.13.45-beta.
|
|
32
|
+
"@airgap/coinlib-core": "^0.13.45-beta.3",
|
|
33
|
+
"@airgap/serializer": "^0.13.45-beta.3"
|
|
34
34
|
},
|
|
35
35
|
"nyc": {
|
|
36
36
|
"include": [
|
|
@@ -2,7 +2,7 @@ import { Address } from '../../../types/address';
|
|
|
2
2
|
import { Balance } from '../../../types/balance';
|
|
3
3
|
import { AirGapTransactionsWithCursor } from '../../../types/transaction';
|
|
4
4
|
import { _OnlineProtocol, OnlineGeneric } from '../../protocol';
|
|
5
|
-
export
|
|
5
|
+
export type FetchDataForAddressExtension<T extends _OnlineProtocol> = T extends _OnlineProtocol<any, any, any, infer _Units, infer _FeeUnits, any, any, any, infer _TransactionCursor, any, infer _BalanceConfiguration> ? FetchDataForAddressProtocol<_Units, _FeeUnits, _TransactionCursor, _BalanceConfiguration> : never;
|
|
6
6
|
export interface FetchDataForAddressProtocol<_Units extends OnlineGeneric['Units'] = OnlineGeneric['Units'], _FeeUnits extends OnlineGeneric['FeeUnits'] = OnlineGeneric['FeeUnits'], _TransactionCursor extends OnlineGeneric['TransactionCursor'] = OnlineGeneric['TransactionCursor'], _BalanceConfiguration extends Object | undefined = undefined> {
|
|
7
7
|
getTransactionsForAddress(address: Address, limit: number, cursor?: _TransactionCursor): Promise<AirGapTransactionsWithCursor<_TransactionCursor, _Units, _FeeUnits>>;
|
|
8
8
|
getBalanceOfAddress(address: Address, configuration?: _BalanceConfiguration): Promise<Balance<_Units>>;
|
|
@@ -2,7 +2,7 @@ import { Address } from '../../../types/address';
|
|
|
2
2
|
import { Balance } from '../../../types/balance';
|
|
3
3
|
import { AirGapTransactionsWithCursor } from '../../../types/transaction';
|
|
4
4
|
import { _OnlineProtocol, OnlineGeneric } from '../../protocol';
|
|
5
|
-
export
|
|
5
|
+
export type FetchDataForMultipleAddressesExtension<T extends _OnlineProtocol> = T extends _OnlineProtocol<any, any, any, infer _Units, infer _FeeUnits, any, any, any, infer _TransactionCursor, any, infer _BalanceConfiguration> ? FetchDataForMultipleAddressesProtocol<_Units, _FeeUnits, _TransactionCursor, _BalanceConfiguration> : never;
|
|
6
6
|
export interface FetchDataForMultipleAddressesProtocol<_Units extends OnlineGeneric['Units'] = OnlineGeneric['Units'], _FeeUnits extends OnlineGeneric['FeeUnits'] = OnlineGeneric['FeeUnits'], _TransactionCursor extends OnlineGeneric['TransactionCursor'] = OnlineGeneric['TransactionCursor'], _BalanceConfiguration extends Object | undefined = undefined> {
|
|
7
7
|
getTransactionsForAddresses(addresses: Address[], limit: number, cursor?: _TransactionCursor): Promise<AirGapTransactionsWithCursor<_TransactionCursor, _Units, _FeeUnits>>;
|
|
8
8
|
getBalanceOfAddresses(addresses: Address[], configuration?: _BalanceConfiguration): Promise<Balance<_Units>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AddressWithCursor } from '../../../types/address';
|
|
2
2
|
import { ExtendedPublicKey, PublicKey } from '../../../types/key';
|
|
3
3
|
import { _AnyProtocol, _BaseProtocol, BaseGeneric } from '../../protocol';
|
|
4
|
-
export
|
|
4
|
+
export type MultiAddressPublicKeyExtension<T extends _AnyProtocol> = T extends _BaseProtocol<infer _BaseAddressCursor, infer _AddressResult, any, any, any, any, infer _PublicKey> ? _AddressResult extends AddressWithCursor<infer _AddressCursor> ? MultiAddressPublicKeyProtocol<_AddressCursor, _PublicKey> : MultiAddressPublicKeyProtocol<_BaseAddressCursor, _PublicKey> : never;
|
|
5
5
|
export interface MultiAddressPublicKeyProtocol<_AddressCursor extends BaseGeneric['AddressCursor'] = BaseGeneric['AddressCursor'], _PublicKey extends PublicKey | ExtendedPublicKey = PublicKey | ExtendedPublicKey> {
|
|
6
6
|
getInitialAddressesFromPublicKey(publicKey: _PublicKey): Promise<AddressWithCursor<_AddressCursor>[]>;
|
|
7
7
|
getNextAddressFromPublicKey(publicKey: _PublicKey, cursor: _AddressCursor): Promise<AddressWithCursor<_AddressCursor> | undefined>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CryptoDerivative } from '../../../types/crypto';
|
|
2
2
|
import { ExtendedKeyPair, ExtendedPublicKey, ExtendedSecretKey, KeyPair, PublicKey, SecretKey } from '../../../types/key';
|
|
3
3
|
import { _AnyProtocol, _BaseProtocol, _OfflineProtocol, _OnlineProtocol, _Protocol, BaseGeneric, OfflineGeneric, OnlineGeneric } from '../../protocol';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export type Bip32Extension<T extends _AnyProtocol> = T extends _Protocol ? InferredOfflineBip32Protocol<T> & InferredOnlineBip32Protocol<T> : T extends _OfflineProtocol ? InferredOfflineBip32Protocol<T> : T extends _OnlineProtocol ? InferredOnlineBip32Protocol<T> : never;
|
|
5
|
+
type InferredOfflineBip32Protocol<T> = T extends _OfflineProtocol<infer _AddressCursor, infer _AddressResult, infer _Units, infer _FeeUnits, infer _SignedTransaction, infer _UnsignedTransaction> ? OfflineBip32Protocol<_AddressCursor, _AddressResult, _Units, _FeeUnits, _SignedTransaction, _UnsignedTransaction> : never;
|
|
6
|
+
type InferredOnlineBip32Protocol<T> = T extends _OnlineProtocol<infer _AddressCursor, infer _AddressResult, infer _ProtocolNetwork, infer _Units, infer _FeeUnits, infer _FeeEstimation, infer _SignedTransaction, infer _UnsignedTransaction, infer _TransactionCursor, any, infer _BalanceConfiguration> ? OnlineBip32Protocol<_AddressCursor, _AddressResult, _ProtocolNetwork, _Units, _FeeUnits, _FeeEstimation, _SignedTransaction, _UnsignedTransaction, _TransactionCursor, _BalanceConfiguration> : never;
|
|
7
7
|
export interface BaseBip32Protocol<_AddressCursor extends BaseGeneric['AddressCursor'] = BaseGeneric['AddressCursor'], _AddressResult extends BaseGeneric['AddressResult'] = BaseGeneric['AddressResult'], _Units extends BaseGeneric['Units'] = BaseGeneric['Units'], _FeeUnits extends BaseGeneric['FeeUnits'] = BaseGeneric['FeeUnits'], _SignedTransaction extends BaseGeneric['SignedTransaction'] = BaseGeneric['SignedTransaction'], _UnsignedTransaction extends BaseGeneric['UnsignedTransaction'] = BaseGeneric['UnsignedTransaction']> extends _BaseProtocol<_AddressCursor, _AddressResult, _Units, _FeeUnits, _SignedTransaction, _UnsignedTransaction, PublicKey | ExtendedPublicKey> {
|
|
8
8
|
deriveFromExtendedPublicKey(extendedPublicKey: ExtendedPublicKey, visibilityIndex: number, addressIndex: number): Promise<PublicKey>;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _AnyProtocol } from '../../protocol';
|
|
2
|
-
export
|
|
2
|
+
export type ConfigurableContractExtension<_T extends _AnyProtocol> = ConfigurableContractProtocol;
|
|
3
3
|
export interface ConfigurableContractProtocol {
|
|
4
4
|
isContractValid(address: string): Promise<boolean>;
|
|
5
5
|
getContractAddress(): Promise<string | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtendedSecretKey, SecretKey } from '../../../types/key';
|
|
2
2
|
import { _OfflineProtocol } from '../../protocol';
|
|
3
|
-
export
|
|
3
|
+
export type AESExtension<T extends _OfflineProtocol> = T extends _OfflineProtocol<any, any, any, any, any, any, any, any, infer _SecretKey> ? AES<_SecretKey> : never;
|
|
4
4
|
export interface AES<_SecretKey extends SecretKey | ExtendedSecretKey = SecretKey> {
|
|
5
5
|
encryptAESWithSecretKey(payload: string, secretKey: _SecretKey): Promise<string>;
|
|
6
6
|
decryptAESWithSecretKey(payload: string, secretKey: _SecretKey): Promise<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtendedKeyPair, ExtendedPublicKey, KeyPair, PublicKey } from '../../../types/key';
|
|
2
2
|
import { _AnyProtocol, _BaseProtocol, _OfflineProtocol } from '../../protocol';
|
|
3
|
-
export
|
|
3
|
+
export type AsymmetricEncryptionExtension<T extends _AnyProtocol> = T extends _OfflineProtocol<any, any, any, any, any, any, any, infer _PublicKey, any, infer _KeyPair> ? OfflineAsymmetricEncryption<_PublicKey, _KeyPair> : T extends _BaseProtocol<any, any, any, any, any, any, infer _PublicKey> ? BaseAsymmetricEncryption<_PublicKey> : never;
|
|
4
4
|
export interface BaseAsymmetricEncryption<_PublicKey extends PublicKey | ExtendedPublicKey = PublicKey> {
|
|
5
5
|
encryptAsymmetricWithPublicKey(payload: string, publicKey: _PublicKey): Promise<string>;
|
|
6
6
|
}
|
|
@@ -2,4 +2,4 @@ import { _AnyProtocol, _OfflineProtocol } from '../../protocol';
|
|
|
2
2
|
import { AESExtension } from './AESExtension';
|
|
3
3
|
import { AsymmetricEncryptionExtension } from './AsymmetricEncryptionExtension';
|
|
4
4
|
import { SignMessageExtension } from './SignMessageExtension';
|
|
5
|
-
export
|
|
5
|
+
export type CryptoExtension<T extends _AnyProtocol> = SignMessageExtension<T> & AsymmetricEncryptionExtension<T> & (T extends _OfflineProtocol ? AESExtension<T> : {});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtendedKeyPair, ExtendedPublicKey, KeyPair, PublicKey } from '../../../types/key';
|
|
2
2
|
import { Signature } from '../../../types/signature';
|
|
3
3
|
import { _AnyProtocol, _BaseProtocol, _OfflineProtocol } from '../../protocol';
|
|
4
|
-
export
|
|
4
|
+
export type SignMessageExtension<T extends _AnyProtocol> = T extends _OfflineProtocol<any, any, any, any, any, any, any, infer _PublicKey, any, infer _KeyPair> ? OfflineSignMessage<_PublicKey, _KeyPair> : T extends _BaseProtocol<any, any, any, any, any, any, infer _PublicKey> ? BaseSignMessage<_PublicKey> : never;
|
|
5
5
|
export interface BaseSignMessage<_PublicKey extends PublicKey | ExtendedPublicKey = PublicKey> {
|
|
6
6
|
verifyMessageWithPublicKey(message: string, signature: Signature, publicKey: _PublicKey): Promise<boolean>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtendedPublicKey, PublicKey } from '../../../types/key';
|
|
2
2
|
import { UnsignedTransaction } from '../../../types/transaction';
|
|
3
3
|
import { _OnlineProtocol } from '../../protocol';
|
|
4
|
-
export
|
|
4
|
+
export type WalletConnectExtension<T extends _OnlineProtocol> = T extends _OnlineProtocol<any, any, any, any, any, any, any, infer _UnsignedTransaction, any, infer _PublicKey> ? WalletConnectProtocol<_UnsignedTransaction, _PublicKey> : never;
|
|
5
5
|
export interface WalletConnectRequest {
|
|
6
6
|
from?: string;
|
|
7
7
|
to?: string;
|
|
@@ -12,6 +12,6 @@ export interface WalletConnectRequest {
|
|
|
12
12
|
nonce?: string;
|
|
13
13
|
}
|
|
14
14
|
export interface WalletConnectProtocol<_UnsignedTransaction extends UnsignedTransaction = UnsignedTransaction, _PublicKey extends PublicKey | ExtendedPublicKey = PublicKey | ExtendedPublicKey> {
|
|
15
|
-
getWalletConnectChain(): Promise<string
|
|
15
|
+
getWalletConnectChain(): Promise<string>;
|
|
16
16
|
prepareWalletConnectTransactionWithPublicKey(publicKey: _PublicKey, request: WalletConnectRequest): Promise<_UnsignedTransaction>;
|
|
17
17
|
}
|
|
@@ -16,7 +16,7 @@ import { SingleTokenSubProtocolExtension } from './sub-protocol/SingleTokenSubPr
|
|
|
16
16
|
import { SubProtocolExtension } from './sub-protocol/SubProtocolExtension';
|
|
17
17
|
import { ConfigurableTransactionInjectorExtension } from './transaction/ConfigurableTransactionInjectorExtension';
|
|
18
18
|
import { TransactionStatusCheckerExtension } from './transaction/TransactionStatusCheckerExtension';
|
|
19
|
-
export
|
|
19
|
+
export type ProtocolExtensions<T> = T extends _Protocol ? OfflineExtensions<T> & OnlineExtensions<T> : T extends _OfflineProtocol ? OfflineExtensions<T> : T extends _OnlineProtocol ? OnlineExtensions<T> : never;
|
|
20
20
|
interface OfflineAndOnlineExtensions<T extends _AnyProtocol> {
|
|
21
21
|
Bip32: Bip32Extension<T>;
|
|
22
22
|
ConfigurableContract: ConfigurableContractExtension<T>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicKey, ExtendedPublicKey } from '../../../types/key';
|
|
2
2
|
import { UnsignedTransaction } from '../../../types/transaction';
|
|
3
3
|
import { _AnyProtocol, _BaseProtocol } from '../../protocol';
|
|
4
|
-
export
|
|
4
|
+
export type MultisigExtension<T extends _AnyProtocol> = T extends _BaseProtocol<any, any, any, any, any, any, infer _PublicKey> ? MultisigProtocol<_PublicKey, UnsignedTransaction> : never;
|
|
5
5
|
export interface MultisigProtocol<_PublicKey extends PublicKey | ExtendedPublicKey = PublicKey, _UnsignedTransaction extends UnsignedTransaction = UnsignedTransaction> {
|
|
6
6
|
getMultisigStatus(publicKey: PublicKey): Promise<boolean>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Amount } from '../../../types/amount';
|
|
2
2
|
import { ExtendedPublicKey, PublicKey } from '../../../types/key';
|
|
3
3
|
import { _OnlineProtocol } from '../../protocol';
|
|
4
|
-
export
|
|
4
|
+
export type GetTokenBalancesExtension<T extends _OnlineProtocol> = T extends _OnlineProtocol<any, any, any, any, any, any, any, any, any, infer _PublicKey> ? GetTokenBalances<_PublicKey> : never;
|
|
5
5
|
interface BaseTokenDetails<_Type extends string> {
|
|
6
6
|
type: _Type;
|
|
7
7
|
identifier: string;
|
|
@@ -12,7 +12,7 @@ interface SingleTokenDetails extends BaseTokenDetails<'single'> {
|
|
|
12
12
|
interface MultiTokenDetails extends BaseTokenDetails<'multi'> {
|
|
13
13
|
tokenId: string;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type TokenDetails = SingleTokenDetails | MultiTokenDetails;
|
|
16
16
|
export interface GetTokenBalances<_PublicKey extends PublicKey | ExtendedPublicKey = PublicKey> {
|
|
17
17
|
getTokenBalancesOfPublicKey(publicKey: _PublicKey, tokens: TokenDetails[]): Promise<Record<string, Amount>>;
|
|
18
18
|
}
|
|
@@ -2,7 +2,7 @@ import { ExtendedPublicKey, PublicKey } from '../../../types/key';
|
|
|
2
2
|
import { Override } from '../../../types/meta/utility-types';
|
|
3
3
|
import { _AnyProtocol, _OnlineProtocol, OnlineGeneric } from '../../protocol';
|
|
4
4
|
import { SingleTokenSubProtocol } from './SingleTokenSubProtocolExtension';
|
|
5
|
-
export
|
|
5
|
+
export type MultiTokenSubProtocolExtension<T extends _AnyProtocol> = T extends _OnlineProtocol<infer _AddressCursor, infer _AddressResult, infer _ProtocolNetwork, infer _Units, infer _FeeUnits, infer _FeeEstimation, infer _SignedTransaction, infer _UnsignedTransaction, infer _TransactionCursor, infer _PublicKey, infer _BalanceConfiguration> ? OnlineMultiTokenSubProtocol<_AddressCursor, _AddressResult, _ProtocolNetwork, _Units, _FeeUnits, _FeeEstimation, _SignedTransaction, _UnsignedTransaction, _TransactionCursor, _PublicKey, _BalanceConfiguration> : BaseMultiTokenSubProtocol;
|
|
6
6
|
export interface BaseMultiTokenSubProtocol extends SingleTokenSubProtocol {
|
|
7
7
|
}
|
|
8
8
|
export interface MultiTokenBalanceConfiguration {
|