@airgap/module-kit 0.13.16-beta.4 → 0.13.16-beta.6
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/index.d.ts +6 -5
- package/index.js +4 -2
- package/index.js.map +1 -1
- package/module/extensions/extensions.d.ts +6 -1
- package/module/extensions/serialization/ProtocolSerializer.d.ts +19 -0
- package/module/extensions/serialization/ProtocolSerializer.js +3 -0
- package/module/extensions/serialization/ProtocolSerializer.js.map +1 -0
- package/module/module.d.ts +2 -1
- package/package.json +1 -1
- package/protocol/extensions/extensions.d.ts +1 -1
- package/utils/module.d.ts +5 -0
- package/utils/module.js +14 -1
- package/utils/module.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { newSignature } from './factories/signature';
|
|
|
5
5
|
import { newSignedTransaction, newUnsignedTransaction } from './factories/transaction';
|
|
6
6
|
import { newErrorUIAlert, newInfoUIAlert, newSuccessUIAlert, newWarningUIAlert } from './factories/ui/alert';
|
|
7
7
|
import { newPlainUIText } from './factories/ui/text';
|
|
8
|
+
import { AirGapSerializedAnyProtocol, AirGapSerializedOfflineProtocol, AirGapSerializedOnlineProtocol, ProtocolSerializerExtension, ProtocolSerializerModule } from './module/extensions/serialization/ProtocolSerializer';
|
|
8
9
|
import { AirGapModule } from './module/module';
|
|
9
10
|
import { ModuleNetworkRegistry } from './module/module-network-registry';
|
|
10
11
|
import { FetchDataForMultipleAddressesExtension, FetchDataForMultipleAddressesProtocol } from './protocol/extensions/address/FetchDataForMultipleAddressesExtension';
|
|
@@ -35,22 +36,22 @@ import { ProtocolAccountMetadata, ProtocolFeeMetadata, ProtocolMetadata, Protoco
|
|
|
35
36
|
import { V3SchemaConfiguration } from './types/serializer';
|
|
36
37
|
import { Signature } from './types/signature';
|
|
37
38
|
import { SubProtocolType } from './types/sub-protocol';
|
|
38
|
-
import { AirGapTransaction, AirGapTransactionStatus, AirGapTransactionsWithCursor, SignedTransaction,
|
|
39
|
+
import { AirGapTransaction, AirGapTransactionStatus, AirGapTransactionsWithCursor, SignedTransaction, TransactionCursor, TransactionDetails, TransactionFullConfiguration, TransactionSimpleConfiguration, TransactionType, UnsignedTransaction } from './types/transaction';
|
|
39
40
|
import { AirGapUIAction } from './types/ui/action';
|
|
40
41
|
import { AirGapUIAlert } from './types/ui/alert';
|
|
41
42
|
import { AirGapUIText } from './types/ui/text';
|
|
42
43
|
import { isAmount } from './utils/amount';
|
|
43
44
|
import { implementsInterface, Schema } from './utils/interface';
|
|
44
45
|
import { isAnyKey, isExtendedPublicKey, isExtendedSecretKey, isPublicKey, isSecretKey } from './utils/key';
|
|
45
|
-
import { createSupportedProtocols } from './utils/module';
|
|
46
|
+
import { canSerializeProtocols, createSupportedProtocols, protocolSerializerSchema } from './utils/module';
|
|
46
47
|
import { normalizeToUndefined } from './utils/normalize';
|
|
47
48
|
import { aesEncryptionSchema, asymmetricEncryptionBaseSchema, asymmetricEncryptionOfflineSchema, baseProtocolSchema, bip32BaseProtocolSchema, bip32OfflineProtocolSchema, bip32OnlineProtocolSchema, canEncryptAES, canEncryptAsymmetric, canFetchDataForAddress, canFetchDataForMultipleAddresses, canSignMessage, configurableContractProtocolSchema, configurableTransactionInjectorSchema, fetchDataForAddressProtocolSchema, fetchDataForMultipleAddressesProtocolSchema, hasConfigurableContract, hasConfigurableTransactionInjector, hasMultiAddressPublicKeys, isAnyProtocol, isBip32Protocol, isMultiTokenSubProtocol, isOfflineProtocol, isOnlineProtocol, isSingleTokenSubProtocol, isSubProtocol, isTransactionStatusChecker, multiAddressPublicKeyProtocolSchema, multiTokenSubProtocolBaseSchema, offlineProtocolSchema, onlineProtocolSchema, protocolNetworkIdentifier, signMessageBaseSchema, signMessageOfflineSchema, singleTokenSubProtocolSchema, subProtocolSchema, transactionStatusCheckerSchema } from './utils/protocol';
|
|
48
49
|
export { AirGapBlockExplorer, BlockExplorerMetadata };
|
|
49
50
|
export { newSuccessUIAlert, newInfoUIAlert, newWarningUIAlert, newErrorUIAlert, newPlainUIText, newAmount, newSecretKey, newExtendedSecretKey, newPublicKey, newExtendedPublicKey, newSignature, newUnsignedTransaction, newSignedTransaction };
|
|
50
|
-
export { AirGapModule, ModuleNetworkRegistry, ProtocolConfiguration, OfflineProtocolConfiguration, OnlineProtocolConfiguration, FullProtocolConfiguration };
|
|
51
|
+
export { AirGapModule, ModuleNetworkRegistry, ProtocolConfiguration, OfflineProtocolConfiguration, OnlineProtocolConfiguration, FullProtocolConfiguration, ProtocolSerializerExtension, ProtocolSerializerModule, AirGapSerializedOfflineProtocol, AirGapSerializedOnlineProtocol, AirGapSerializedAnyProtocol };
|
|
51
52
|
export { AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapProtocol, AirGapAnyProtocol, FetchDataForMultipleAddressesExtension, FetchDataForMultipleAddressesProtocol, MultiAddressPublicKeyExtension, MultiAddressPublicKeyProtocol, Bip32Extension, OfflineBip32Protocol, OnlineBip32Protocol, SubProtocolExtension, SubProtocol, SingleTokenSubProtocolExtension, SingleTokenSubProtocol, MultiTokenSubProtocolExtension, BaseMultiTokenSubProtocol, OnlineMultiTokenSubProtocol, CryptoExtension, AESExtension, AsymmetricEncryptionExtension, SignMessageExtension, TransactionStatusCheckerExtension, ProtocolMetadata, ProtocolUnitsMetadata, ProtocolSymbol, ProtocolFeeMetadata, ProtocolAccountMetadata, ProtocolTransactionMetadata, ProtocolNetworkType, ProtocolNetwork, SubProtocolType };
|
|
52
53
|
export { AirGapV3SerializerCompanion, V3SchemaConfiguration };
|
|
53
54
|
export { AirGapInterface };
|
|
54
55
|
export { AirGapUIAction, AirGapUIAlert, AirGapUIText, Address, AddressCursor, AddressWithCursor, Amount, Balance, MultiTokenBalanceConfiguration, BytesStringFormat, BytesString, HexString, CryptoAlgorithm, CryptoSecretType, Ed25519CryptoConfiguration, Sr25519CryptoConfiguration, Secp256K1CryptoConfiguration, SaplingCryptoConfiguration, CryptoConfiguration, CryptoDerivative, FeeDefaults, FeeEstimation, KeyType, SecretKey, ExtendedSecretKey, PublicKey, ExtendedPublicKey, KeyPair, ExtendedKeyPair, Signature, TransactionType, UnsignedTransaction, SignedTransaction, AirGapTransaction, TransactionCursor, AirGapTransactionsWithCursor, TransactionDetails, TransactionSimpleConfiguration, TransactionFullConfiguration, AirGapTransactionStatus, RecursivePartial };
|
|
55
|
-
export { isAmount, Schema, implementsInterface, isAnyKey, isSecretKey, isExtendedSecretKey, isPublicKey, isExtendedPublicKey, createSupportedProtocols, isAnyProtocol, isOfflineProtocol, isOnlineProtocol, isBip32Protocol, isSubProtocol, isSingleTokenSubProtocol, isMultiTokenSubProtocol, canFetchDataForAddress, canFetchDataForMultipleAddresses, hasMultiAddressPublicKeys, hasConfigurableContract, canEncryptAES, canEncryptAsymmetric, canSignMessage, hasConfigurableTransactionInjector, isTransactionStatusChecker, protocolNetworkIdentifier, normalizeToUndefined };
|
|
56
|
-
export { baseProtocolSchema, offlineProtocolSchema, onlineProtocolSchema, bip32BaseProtocolSchema, bip32OfflineProtocolSchema, bip32OnlineProtocolSchema, subProtocolSchema, singleTokenSubProtocolSchema, multiTokenSubProtocolBaseSchema, fetchDataForAddressProtocolSchema, fetchDataForMultipleAddressesProtocolSchema, multiAddressPublicKeyProtocolSchema, configurableContractProtocolSchema, aesEncryptionSchema, asymmetricEncryptionBaseSchema, asymmetricEncryptionOfflineSchema, signMessageBaseSchema, signMessageOfflineSchema, configurableTransactionInjectorSchema, transactionStatusCheckerSchema };
|
|
56
|
+
export { isAmount, Schema, implementsInterface, isAnyKey, isSecretKey, isExtendedSecretKey, isPublicKey, isExtendedPublicKey, createSupportedProtocols, canSerializeProtocols, isAnyProtocol, isOfflineProtocol, isOnlineProtocol, isBip32Protocol, isSubProtocol, isSingleTokenSubProtocol, isMultiTokenSubProtocol, canFetchDataForAddress, canFetchDataForMultipleAddresses, hasMultiAddressPublicKeys, hasConfigurableContract, canEncryptAES, canEncryptAsymmetric, canSignMessage, hasConfigurableTransactionInjector, isTransactionStatusChecker, protocolNetworkIdentifier, normalizeToUndefined };
|
|
57
|
+
export { protocolSerializerSchema, baseProtocolSchema, offlineProtocolSchema, onlineProtocolSchema, bip32BaseProtocolSchema, bip32OfflineProtocolSchema, bip32OnlineProtocolSchema, subProtocolSchema, singleTokenSubProtocolSchema, multiTokenSubProtocolBaseSchema, fetchDataForAddressProtocolSchema, fetchDataForMultipleAddressesProtocolSchema, multiAddressPublicKeyProtocolSchema, configurableContractProtocolSchema, aesEncryptionSchema, asymmetricEncryptionBaseSchema, asymmetricEncryptionOfflineSchema, signMessageBaseSchema, signMessageOfflineSchema, configurableTransactionInjectorSchema, transactionStatusCheckerSchema };
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.transactionStatusCheckerSchema = exports.configurableTransactionInjectorSchema = exports.signMessageOfflineSchema = exports.signMessageBaseSchema = exports.asymmetricEncryptionOfflineSchema = exports.asymmetricEncryptionBaseSchema = exports.aesEncryptionSchema = exports.configurableContractProtocolSchema = exports.multiAddressPublicKeyProtocolSchema = exports.fetchDataForMultipleAddressesProtocolSchema = void 0;
|
|
3
|
+
exports.singleTokenSubProtocolSchema = exports.subProtocolSchema = exports.bip32OnlineProtocolSchema = exports.bip32OfflineProtocolSchema = exports.bip32BaseProtocolSchema = exports.onlineProtocolSchema = exports.offlineProtocolSchema = exports.baseProtocolSchema = exports.protocolSerializerSchema = exports.normalizeToUndefined = exports.protocolNetworkIdentifier = exports.isTransactionStatusChecker = exports.hasConfigurableTransactionInjector = exports.canSignMessage = exports.canEncryptAsymmetric = exports.canEncryptAES = exports.hasConfigurableContract = exports.hasMultiAddressPublicKeys = exports.canFetchDataForMultipleAddresses = exports.canFetchDataForAddress = exports.isMultiTokenSubProtocol = 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
|
+
exports.transactionStatusCheckerSchema = exports.configurableTransactionInjectorSchema = exports.signMessageOfflineSchema = exports.signMessageBaseSchema = exports.asymmetricEncryptionOfflineSchema = exports.asymmetricEncryptionBaseSchema = exports.aesEncryptionSchema = exports.configurableContractProtocolSchema = exports.multiAddressPublicKeyProtocolSchema = exports.fetchDataForMultipleAddressesProtocolSchema = exports.fetchDataForAddressProtocolSchema = exports.multiTokenSubProtocolBaseSchema = void 0;
|
|
5
5
|
var amount_1 = require("./factories/amount");
|
|
6
6
|
Object.defineProperty(exports, "newAmount", { enumerable: true, get: function () { return amount_1.newAmount; } });
|
|
7
7
|
var key_1 = require("./factories/key");
|
|
@@ -34,7 +34,9 @@ Object.defineProperty(exports, "isExtendedSecretKey", { enumerable: true, get: f
|
|
|
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
|
var module_1 = require("./utils/module");
|
|
37
|
+
Object.defineProperty(exports, "canSerializeProtocols", { enumerable: true, get: function () { return module_1.canSerializeProtocols; } });
|
|
37
38
|
Object.defineProperty(exports, "createSupportedProtocols", { enumerable: true, get: function () { return module_1.createSupportedProtocols; } });
|
|
39
|
+
Object.defineProperty(exports, "protocolSerializerSchema", { enumerable: true, get: function () { return module_1.protocolSerializerSchema; } });
|
|
38
40
|
var normalize_1 = require("./utils/normalize");
|
|
39
41
|
Object.defineProperty(exports, "normalizeToUndefined", { enumerable: true, get: function () { return normalize_1.normalizeToUndefined; } });
|
|
40
42
|
var protocol_1 = require("./utils/protocol");
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,6CAA8C;AA6I5C,0FA7IO,kBAAS,OA6IP;AA5IX,uCAAwG;AAgJtG,qGAhJO,0BAAoB,OAgJP;AAFpB,qGA9I6B,0BAAoB,OA8I7B;AACpB,6FA/ImD,kBAAY,OA+InD;AAFZ,6FA7IiE,kBAAY,OA6IjE;AA5Id,mDAAoD;AAgJlD,6FAhJO,wBAAY,OAgJP;AA/Id,uDAAsF;AAiJpF,qGAjJO,kCAAoB,OAiJP;AADpB,uGAhJ6B,oCAAsB,OAgJ7B;AA/IxB,8CAA4G;AAuI1G,gGAvIO,uBAAe,OAuIP;AAFf,+FArIwB,sBAAc,OAqIxB;AADd,kGApIwC,yBAAiB,OAoIxC;AAEjB,kGAtI2D,yBAAiB,OAsI3D;AArInB,4CAAoD;AAuIlD,+FAvIO,qBAAc,OAuIP;AA9HhB,4EAAwE;AA6ItE,sGA7IO,+CAAqB,OA6IP;AAvEvB,yCAAyC;AAiLvC,yFAjLO,iBAAQ,OAiLP;AAhLV,+CAA+D;AAkL7D,oGAlLO,+BAAmB,OAkLP;AAjLrB,mCAA0G;AAkLxG,yFAlLO,cAAQ,OAkLP;AAIR,oGAtLiB,yBAAmB,OAsLjB;AAFnB,oGApLsC,yBAAmB,OAoLtC;AACnB,4FArL2D,iBAAW,OAqL3D;AAFX,4FAnLwE,iBAAW,OAmLxE;AAlLb,yCAA0G;AAuLxG,sGAvLO,8BAAqB,OAuLP;AADrB,yGAtL8B,iCA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,yCAA8B,OA4LA"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { Module } from '../module';
|
|
2
|
+
import { ProtocolSerializerExtension } from './serialization/ProtocolSerializer';
|
|
3
|
+
export declare type ModuleExtensions<T> = T extends Module ? Extensions<T> : never;
|
|
4
|
+
interface Extensions<T extends Module> {
|
|
5
|
+
ProtocolSerializer: ProtocolSerializerExtension<T>;
|
|
2
6
|
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AirGapOfflineProtocol, AirGapOnlineProtocol } from '../../../protocol/protocol';
|
|
2
|
+
import { Module } from '../../module';
|
|
3
|
+
interface AirGapSerializedBaseProtocol<T extends string> {
|
|
4
|
+
type: T;
|
|
5
|
+
identifier: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AirGapSerializedOfflineProtocol extends AirGapSerializedBaseProtocol<'offline'> {
|
|
8
|
+
}
|
|
9
|
+
export interface AirGapSerializedOnlineProtocol extends AirGapSerializedBaseProtocol<'online'> {
|
|
10
|
+
}
|
|
11
|
+
export declare type AirGapSerializedAnyProtocol = AirGapSerializedOfflineProtocol | AirGapSerializedOnlineProtocol;
|
|
12
|
+
export declare type ProtocolSerializerExtension<_T extends Module> = ProtocolSerializerModule;
|
|
13
|
+
export interface ProtocolSerializerModule {
|
|
14
|
+
serializeOfflineProtocol(protocol: AirGapOfflineProtocol): Promise<AirGapSerializedOfflineProtocol | undefined>;
|
|
15
|
+
deserializeOfflineProtocol(serialized: AirGapSerializedOfflineProtocol): Promise<AirGapOfflineProtocol | undefined>;
|
|
16
|
+
serializeOnlineProtocol(protocol: AirGapOnlineProtocol): Promise<AirGapSerializedOnlineProtocol | undefined>;
|
|
17
|
+
deserializeOnlineProtocol(serialized: AirGapSerializedOnlineProtocol): Promise<AirGapOnlineProtocol | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProtocolSerializer.js","sourceRoot":"","sources":["../../../../src/module/extensions/serialization/ProtocolSerializer.ts"],"names":[],"mappings":""}
|
package/module/module.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AirGapBlockExplorer } from '../block-explorer/block-explorer';
|
|
|
2
2
|
import { AirGapOfflineProtocol, AirGapOnlineProtocol } from '../protocol/protocol';
|
|
3
3
|
import { AirGapV3SerializerCompanion } from '../serializer/serializer';
|
|
4
4
|
import { AirGapInterface } from '../types/airgap';
|
|
5
|
+
import { ApplicableModuleExtension } from '../types/airgap';
|
|
5
6
|
import { Complement } from '../types/meta/utility-types';
|
|
6
7
|
import { ProtocolConfiguration } from '../types/module';
|
|
7
8
|
import { ProtocolNetwork } from '../types/protocol';
|
|
@@ -19,5 +20,5 @@ interface _Module<_Protocols extends ModuleGeneric['Protocols'] = any, _Protocol
|
|
|
19
20
|
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
20
21
|
}
|
|
21
22
|
export declare type Module<G extends Partial<ModuleGeneric> = {}> = _Module<TypedProtocols<G>, TypedProtocolNetwork<G>>;
|
|
22
|
-
export declare type AirGapModule<G extends Partial<ModuleGeneric> = {}> = AirGapInterface<Module<G
|
|
23
|
+
export declare 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>;
|
|
23
24
|
export {};
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _OfflineProtocol, _OnlineProtocol,
|
|
1
|
+
import { _AnyProtocol, _OfflineProtocol, _OnlineProtocol, _Protocol } from '../protocol';
|
|
2
2
|
import { FetchDataForAddressExtension } from './address/FetchDataForAddressExtension';
|
|
3
3
|
import { FetchDataForMultipleAddressesExtension } from './address/FetchDataForMultipleAddressesExtension';
|
|
4
4
|
import { MultiAddressPublicKeyExtension } from './address/MultiAddressPublicKeyExtension';
|
package/utils/module.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { ProtocolSerializerExtension, ProtocolSerializerModule } from '../module/extensions/serialization/ProtocolSerializer';
|
|
2
|
+
import { Module } from '../module/module';
|
|
1
3
|
import { ModuleNetworkRegistry } from '../module/module-network-registry';
|
|
2
4
|
import { ProtocolConfiguration } from '../types/module';
|
|
3
5
|
import { ProtocolNetwork } from '../types/protocol';
|
|
6
|
+
import { Schema } from './interface';
|
|
4
7
|
export declare function createSupportedProtocols<P extends string = string>(online: Record<P, ModuleNetworkRegistry> | Record<P, Record<string, ProtocolNetwork>>, offline?: P[]): Record<P, ProtocolConfiguration>;
|
|
8
|
+
export declare const protocolSerializerSchema: Schema<ProtocolSerializerModule>;
|
|
9
|
+
export declare function canSerializeProtocols<T extends Module>(module: T): module is T & ProtocolSerializerExtension<T>;
|
package/utils/module.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSupportedProtocols = void 0;
|
|
3
|
+
exports.canSerializeProtocols = exports.protocolSerializerSchema = exports.createSupportedProtocols = void 0;
|
|
4
|
+
var interface_1 = require("./interface");
|
|
4
5
|
function createSupportedProtocols(online, offline) {
|
|
5
6
|
var onlineIdentifiers = new Set(Object.keys(online));
|
|
6
7
|
var offlineIdentifiers = offline ? new Set(offline) : onlineIdentifiers;
|
|
@@ -26,4 +27,16 @@ function createOnlineProtocolConfiguration(networks) {
|
|
|
26
27
|
networks: (_a = networks.supportedNetworks) !== null && _a !== void 0 ? _a : networks
|
|
27
28
|
};
|
|
28
29
|
}
|
|
30
|
+
// Schemas
|
|
31
|
+
exports.protocolSerializerSchema = {
|
|
32
|
+
serializeOfflineProtocol: 'required',
|
|
33
|
+
deserializeOfflineProtocol: 'required',
|
|
34
|
+
serializeOnlineProtocol: 'required',
|
|
35
|
+
deserializeOnlineProtocol: 'required'
|
|
36
|
+
};
|
|
37
|
+
// Implementation Checks
|
|
38
|
+
function canSerializeProtocols(module) {
|
|
39
|
+
return (0, interface_1.implementsInterface)(module, exports.protocolSerializerSchema);
|
|
40
|
+
}
|
|
41
|
+
exports.canSerializeProtocols = canSerializeProtocols;
|
|
29
42
|
//# sourceMappingURL=module.js.map
|
package/utils/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/utils/module.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/utils/module.ts"],"names":[],"mappings":";;;AAMA,yCAAyD;AAEzD,SAAgB,wBAAwB,CACtC,MAAqF,EACrF,OAAa;IAEb,IAAM,iBAAiB,GAAW,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAQ,CAAC,CAAA;IACrE,IAAM,kBAAkB,GAAW,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAA;IAEjF,IAAM,WAAW,GAAW,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAA;IAExG,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,UAAC,GAAqC,EAAE,IAAO;;QACnF,IAAM,oBAAoB,GAA6C,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC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