@airgap/module-kit 0.13.16-beta.12 → 0.13.16-beta.13
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 +8 -5
- package/index.js +4 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/protocol/extensions/address/MultiAddressPublicKeyExtension.d.ts +1 -1
- package/protocol/extensions/dapp/WalletConnectProtocol.d.ts +25 -0
- package/protocol/extensions/dapp/WalletConnectProtocol.js +3 -0
- package/protocol/extensions/dapp/WalletConnectProtocol.js.map +1 -0
- package/protocol/extensions/extensions.d.ts +2 -0
- package/utils/protocol.d.ts +3 -0
- package/utils/protocol.js +9 -1
- package/utils/protocol.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { AESExtension } from './protocol/extensions/crypto/AESExtension';
|
|
|
15
15
|
import { AsymmetricEncryptionExtension } from './protocol/extensions/crypto/AsymmetricEncryptionExtension';
|
|
16
16
|
import { CryptoExtension } from './protocol/extensions/crypto/CryptoExtension';
|
|
17
17
|
import { SignMessageExtension } from './protocol/extensions/crypto/SignMessageExtension';
|
|
18
|
+
import { WalletConnectExtension, WalletConnectProtocol, WalletConnectRequest, WalletConnectTransaction } from './protocol/extensions/dapp/WalletConnectProtocol';
|
|
18
19
|
import { BaseMultiTokenSubProtocol, MultiTokenBalanceConfiguration, MultiTokenSubProtocolExtension, OnlineMultiTokenSubProtocol } from './protocol/extensions/sub-protocol/MultiTokenSubProtocolExtension';
|
|
19
20
|
import { SingleTokenSubProtocol, SingleTokenSubProtocolExtension } from './protocol/extensions/sub-protocol/SingleTokenSubProtocolExtension';
|
|
20
21
|
import { SubProtocol, SubProtocolExtension } from './protocol/extensions/sub-protocol/SubProtocolExtension';
|
|
@@ -45,13 +46,15 @@ import { implementsInterface, Schema } from './utils/interface';
|
|
|
45
46
|
import { isAnyKey, isExtendedPublicKey, isExtendedSecretKey, isPublicKey, isSecretKey } from './utils/key';
|
|
46
47
|
import { canSerializeProtocols, createSupportedProtocols, protocolSerializerSchema } from './utils/module';
|
|
47
48
|
import { normalizeToUndefined } from './utils/normalize';
|
|
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';
|
|
49
|
+
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, supportsWalletConnect, transactionStatusCheckerSchema, walletConnectProtocolSchema } from './utils/protocol';
|
|
49
50
|
export { AirGapBlockExplorer, BlockExplorerMetadata };
|
|
50
51
|
export { newSuccessUIAlert, newInfoUIAlert, newWarningUIAlert, newErrorUIAlert, newPlainUIText, newAmount, newSecretKey, newExtendedSecretKey, newPublicKey, newExtendedPublicKey, newSignature, newUnsignedTransaction, newSignedTransaction };
|
|
51
|
-
export { AirGapModule, ModuleNetworkRegistry, ProtocolConfiguration, OfflineProtocolConfiguration, OnlineProtocolConfiguration, FullProtocolConfiguration,
|
|
52
|
-
export {
|
|
52
|
+
export { AirGapModule, ModuleNetworkRegistry, ProtocolConfiguration, OfflineProtocolConfiguration, OnlineProtocolConfiguration, FullProtocolConfiguration, AirGapSerializedOfflineProtocol, AirGapSerializedOnlineProtocol, AirGapSerializedAnyProtocol };
|
|
53
|
+
export { ProtocolSerializerExtension, ProtocolSerializerModule };
|
|
54
|
+
export { AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapProtocol, AirGapAnyProtocol, ProtocolMetadata, ProtocolUnitsMetadata, ProtocolSymbol, ProtocolFeeMetadata, ProtocolAccountMetadata, ProtocolTransactionMetadata, ProtocolNetworkType, ProtocolNetwork, SubProtocolType };
|
|
55
|
+
export { FetchDataForMultipleAddressesExtension, FetchDataForMultipleAddressesProtocol, MultiAddressPublicKeyExtension, MultiAddressPublicKeyProtocol, Bip32Extension, OfflineBip32Protocol, OnlineBip32Protocol, SubProtocolExtension, SubProtocol, SingleTokenSubProtocolExtension, SingleTokenSubProtocol, MultiTokenSubProtocolExtension, BaseMultiTokenSubProtocol, OnlineMultiTokenSubProtocol, CryptoExtension, AESExtension, AsymmetricEncryptionExtension, SignMessageExtension, TransactionStatusCheckerExtension, WalletConnectRequest, WalletConnectTransaction, WalletConnectExtension, WalletConnectProtocol };
|
|
53
56
|
export { AirGapV3SerializerCompanion, V3SchemaConfiguration };
|
|
54
57
|
export { AirGapInterface };
|
|
55
58
|
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 };
|
|
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 };
|
|
59
|
+
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, supportsWalletConnect, protocolNetworkIdentifier, normalizeToUndefined };
|
|
60
|
+
export { protocolSerializerSchema, baseProtocolSchema, offlineProtocolSchema, onlineProtocolSchema, bip32BaseProtocolSchema, bip32OfflineProtocolSchema, bip32OnlineProtocolSchema, subProtocolSchema, singleTokenSubProtocolSchema, multiTokenSubProtocolBaseSchema, fetchDataForAddressProtocolSchema, fetchDataForMultipleAddressesProtocolSchema, multiAddressPublicKeyProtocolSchema, configurableContractProtocolSchema, aesEncryptionSchema, asymmetricEncryptionBaseSchema, asymmetricEncryptionOfflineSchema, signMessageBaseSchema, signMessageOfflineSchema, configurableTransactionInjectorSchema, transactionStatusCheckerSchema, walletConnectProtocolSchema };
|
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 = exports.fetchDataForAddressProtocolSchema = exports.multiTokenSubProtocolBaseSchema = void 0;
|
|
3
|
+
exports.subProtocolSchema = exports.bip32OnlineProtocolSchema = 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.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.walletConnectProtocolSchema = exports.transactionStatusCheckerSchema = exports.configurableTransactionInjectorSchema = exports.signMessageOfflineSchema = exports.signMessageBaseSchema = exports.asymmetricEncryptionOfflineSchema = exports.asymmetricEncryptionBaseSchema = exports.aesEncryptionSchema = exports.configurableContractProtocolSchema = exports.multiAddressPublicKeyProtocolSchema = exports.fetchDataForMultipleAddressesProtocolSchema = exports.fetchDataForAddressProtocolSchema = exports.multiTokenSubProtocolBaseSchema = exports.singleTokenSubProtocolSchema = 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");
|
|
@@ -76,5 +76,7 @@ Object.defineProperty(exports, "signMessageBaseSchema", { enumerable: true, get:
|
|
|
76
76
|
Object.defineProperty(exports, "signMessageOfflineSchema", { enumerable: true, get: function () { return protocol_1.signMessageOfflineSchema; } });
|
|
77
77
|
Object.defineProperty(exports, "singleTokenSubProtocolSchema", { enumerable: true, get: function () { return protocol_1.singleTokenSubProtocolSchema; } });
|
|
78
78
|
Object.defineProperty(exports, "subProtocolSchema", { enumerable: true, get: function () { return protocol_1.subProtocolSchema; } });
|
|
79
|
+
Object.defineProperty(exports, "supportsWalletConnect", { enumerable: true, get: function () { return protocol_1.supportsWalletConnect; } });
|
|
79
80
|
Object.defineProperty(exports, "transactionStatusCheckerSchema", { enumerable: true, get: function () { return protocol_1.transactionStatusCheckerSchema; } });
|
|
81
|
+
Object.defineProperty(exports, "walletConnectProtocolSchema", { enumerable: true, get: function () { return protocol_1.walletConnectProtocolSchema; } });
|
|
80
82
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,6CAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,6CAA8C;AAqJ5C,0FArJO,kBAAS,OAqJP;AApJX,uCAAwG;AAwJtG,qGAxJO,0BAAoB,OAwJP;AAFpB,qGAtJ6B,0BAAoB,OAsJ7B;AACpB,6FAvJmD,kBAAY,OAuJnD;AAFZ,6FArJiE,kBAAY,OAqJjE;AApJd,mDAAoD;AAwJlD,6FAxJO,wBAAY,OAwJP;AAvJd,uDAAsF;AAyJpF,qGAzJO,kCAAoB,OAyJP;AADpB,uGAxJ6B,oCAAsB,OAwJ7B;AAvJxB,8CAA4G;AA+I1G,gGA/IO,uBAAe,OA+IP;AAFf,+FA7IwB,sBAAc,OA6IxB;AADd,kGA5IwC,yBAAiB,OA4IxC;AAEjB,kGA9I2D,yBAAiB,OA8I3D;AA7InB,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AAiB,OA6KA;AACjB,iGA7KA,2BAAgB,OA6KA;AAGhB,yGA/KA,mCAAwB,OA+KA;AADxB,8FA7KA,wBAAa,OA6KA;AAWb,2GAvLA,qCAA0B,OAuLA;AAqB1B,oHA3MA,8CAAmC,OA2MA;AAHnC,gHAvMA,0CAA+B,OAuMA;AAP/B,sGA/LA,gCAAqB,OA+LA;AACrB,qGA/LA,+BAAoB,OA+LA;AAVpB,0GApLA,oCAAyB,OAoLA;AAwBzB,sGA3MA,gCAAqB,OA2MA;AACrB,yGA3MA,mCAAwB,OA2MA;AAVxB,6GAhMA,uCAA4B,OAgMA;AAD5B,kGA9LA,4BAAiB,OA8LA;AAfjB,sGA9KA,gCAAqB,OA8KA;AA4BrB,+GAzMA,yCAA8B,OAyMA;AAC9B,4GAzMA,sCAA2B,OAyMA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { AddressWithCursor } from '../../../types/address';
|
|
|
2
2
|
import { ExtendedPublicKey, PublicKey } from '../../../types/key';
|
|
3
3
|
import { _AnyProtocol, _BaseProtocol, BaseGeneric } from '../../protocol';
|
|
4
4
|
export declare 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
|
-
export interface MultiAddressPublicKeyProtocol<_AddressCursor extends BaseGeneric['AddressCursor'] = BaseGeneric['AddressCursor'], _PublicKey extends PublicKey | ExtendedPublicKey = PublicKey> {
|
|
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>;
|
|
8
8
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ExtendedPublicKey, PublicKey } from '../../../types/key';
|
|
2
|
+
import { _OnlineProtocol } from '../../protocol';
|
|
3
|
+
export declare type WalletConnectExtension<T extends _OnlineProtocol> = T extends _OnlineProtocol<any, any, any, any, any, any, any, any, any, infer _PublicKey> ? WalletConnectProtocol<_PublicKey> : never;
|
|
4
|
+
export interface WalletConnectRequest {
|
|
5
|
+
from?: string;
|
|
6
|
+
to?: string;
|
|
7
|
+
data?: string;
|
|
8
|
+
gasLimit?: string;
|
|
9
|
+
gasPrice?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
nonce?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WalletConnectTransaction {
|
|
14
|
+
to: string;
|
|
15
|
+
data?: string;
|
|
16
|
+
gasLimit: string;
|
|
17
|
+
gasPrice: string;
|
|
18
|
+
value: string;
|
|
19
|
+
nonce: string;
|
|
20
|
+
chainId: number;
|
|
21
|
+
}
|
|
22
|
+
export interface WalletConnectProtocol<_PublicKey extends PublicKey | ExtendedPublicKey = PublicKey | ExtendedPublicKey> {
|
|
23
|
+
getWalletConnectChainId(): Promise<number>;
|
|
24
|
+
prepareWalletConnectTransactionWithPublicKey(publicKey: _PublicKey, request: WalletConnectRequest): Promise<WalletConnectTransaction>;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletConnectProtocol.js","sourceRoot":"","sources":["../../../../src/protocol/extensions/dapp/WalletConnectProtocol.ts"],"names":[],"mappings":""}
|
|
@@ -8,6 +8,7 @@ import { AESExtension } from './crypto/AESExtension';
|
|
|
8
8
|
import { AsymmetricEncryptionExtension } from './crypto/AsymmetricEncryptionExtension';
|
|
9
9
|
import { CryptoExtension } from './crypto/CryptoExtension';
|
|
10
10
|
import { SignMessageExtension } from './crypto/SignMessageExtension';
|
|
11
|
+
import { WalletConnectExtension } from './dapp/WalletConnectProtocol';
|
|
11
12
|
import { MultiTokenSubProtocolExtension } from './sub-protocol/MultiTokenSubProtocolExtension';
|
|
12
13
|
import { SingleTokenSubProtocolExtension } from './sub-protocol/SingleTokenSubProtocolExtension';
|
|
13
14
|
import { SubProtocolExtension } from './sub-protocol/SubProtocolExtension';
|
|
@@ -33,5 +34,6 @@ interface OnlineExtensions<T extends _OnlineProtocol> extends OfflineAndOnlineEx
|
|
|
33
34
|
FetchDataForMultipleAddresses: FetchDataForMultipleAddressesExtension<T>;
|
|
34
35
|
ConfigurableTransactionInjector: ConfigurableTransactionInjectorExtension<T>;
|
|
35
36
|
TransactionStatusChecker: TransactionStatusCheckerExtension<T>;
|
|
37
|
+
WalletConnect: WalletConnectExtension<T>;
|
|
36
38
|
}
|
|
37
39
|
export {};
|
package/utils/protocol.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ConfigurableContractProtocol } from '../protocol/extensions/contract/Co
|
|
|
6
6
|
import { AES, AESExtension } from '../protocol/extensions/crypto/AESExtension';
|
|
7
7
|
import { AsymmetricEncryptionExtension, BaseAsymmetricEncryption, OfflineAsymmetricEncryption } from '../protocol/extensions/crypto/AsymmetricEncryptionExtension';
|
|
8
8
|
import { BaseSignMessage, OfflineSignMessage, SignMessageExtension } from '../protocol/extensions/crypto/SignMessageExtension';
|
|
9
|
+
import { WalletConnectExtension, WalletConnectProtocol } from '../protocol/extensions/dapp/WalletConnectProtocol';
|
|
9
10
|
import { BaseMultiTokenSubProtocol, MultiTokenSubProtocolExtension, OnlineMultiTokenSubProtocol } from '../protocol/extensions/sub-protocol/MultiTokenSubProtocolExtension';
|
|
10
11
|
import { SingleTokenSubProtocol, SingleTokenSubProtocolExtension } from '../protocol/extensions/sub-protocol/SingleTokenSubProtocolExtension';
|
|
11
12
|
import { SubProtocol } from '../protocol/extensions/sub-protocol/SubProtocolExtension';
|
|
@@ -35,6 +36,7 @@ export declare const signMessageBaseSchema: Schema<BaseSignMessage>;
|
|
|
35
36
|
export declare const signMessageOfflineSchema: Schema<OfflineSignMessage>;
|
|
36
37
|
export declare const configurableTransactionInjectorSchema: Schema<ConfigurableTransactionInjectorProtocol>;
|
|
37
38
|
export declare const transactionStatusCheckerSchema: Schema<TransactionStatusChecker>;
|
|
39
|
+
export declare const walletConnectProtocolSchema: Schema<WalletConnectProtocol>;
|
|
38
40
|
export declare function isAnyProtocol(object: unknown): object is AnyProtocol;
|
|
39
41
|
export declare function isOfflineProtocol(object: unknown): object is OfflineProtocol;
|
|
40
42
|
export declare function isOnlineProtocol(object: unknown): object is OnlineProtocol;
|
|
@@ -51,4 +53,5 @@ export declare function canEncryptAsymmetric<T extends AnyProtocol>(protocol: T)
|
|
|
51
53
|
export declare function canSignMessage<T extends AnyProtocol>(protocol: T): protocol is T & SignMessageExtension<T>;
|
|
52
54
|
export declare function hasConfigurableTransactionInjector<T extends OnlineProtocol>(protocol: T): protocol is T & ConfigurableTransactionInjectorProtocol;
|
|
53
55
|
export declare function isTransactionStatusChecker<T extends OnlineProtocol>(protocol: T): protocol is T & TransactionStatusCheckerExtension<T>;
|
|
56
|
+
export declare function supportsWalletConnect<T extends OnlineProtocol>(protocol: T): protocol is T & WalletConnectExtension<T>;
|
|
54
57
|
export declare function protocolNetworkIdentifier(network: ProtocolNetwork): string;
|
package/utils/protocol.js
CHANGED
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
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.transactionStatusCheckerSchema = exports.configurableTransactionInjectorSchema = exports.signMessageOfflineSchema = exports.signMessageBaseSchema = exports.asymmetricEncryptionOfflineSchema = exports.asymmetricEncryptionBaseSchema = exports.aesEncryptionSchema = exports.configurableContractProtocolSchema = exports.multiAddressPublicKeyProtocolSchema = exports.fetchDataForMultipleAddressesProtocolSchema = exports.fetchDataForAddressProtocolSchema = exports.multiTokenSubProtocolOnlineSchema = exports.multiTokenSubProtocolBaseSchema = exports.singleTokenSubProtocolSchema = exports.subProtocolSchema = exports.bip32OnlineProtocolSchema = exports.bip32OfflineProtocolSchema = exports.bip32BaseProtocolSchema = exports.onlineProtocolSchema = exports.offlineProtocolSchema = exports.baseProtocolSchema = void 0;
|
|
14
|
+
exports.protocolNetworkIdentifier = exports.supportsWalletConnect = 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.walletConnectProtocolSchema = exports.transactionStatusCheckerSchema = exports.configurableTransactionInjectorSchema = exports.signMessageOfflineSchema = exports.signMessageBaseSchema = exports.asymmetricEncryptionOfflineSchema = exports.asymmetricEncryptionBaseSchema = exports.aesEncryptionSchema = exports.configurableContractProtocolSchema = exports.multiAddressPublicKeyProtocolSchema = exports.fetchDataForMultipleAddressesProtocolSchema = exports.fetchDataForAddressProtocolSchema = exports.multiTokenSubProtocolOnlineSchema = exports.multiTokenSubProtocolBaseSchema = exports.singleTokenSubProtocolSchema = exports.subProtocolSchema = exports.bip32OnlineProtocolSchema = exports.bip32OfflineProtocolSchema = exports.bip32BaseProtocolSchema = exports.onlineProtocolSchema = exports.offlineProtocolSchema = exports.baseProtocolSchema = void 0;
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
var createHash = require("@airgap/coinlib-core/dependencies/src/create-hash-1.2.0/index");
|
|
17
17
|
var interface_1 = require("./interface");
|
|
@@ -69,6 +69,10 @@ exports.configurableTransactionInjectorSchema = {
|
|
|
69
69
|
exports.transactionStatusCheckerSchema = {
|
|
70
70
|
getTransactionStatus: 'required'
|
|
71
71
|
};
|
|
72
|
+
exports.walletConnectProtocolSchema = {
|
|
73
|
+
getWalletConnectChainId: 'required',
|
|
74
|
+
prepareWalletConnectTransactionWithPublicKey: 'required'
|
|
75
|
+
};
|
|
72
76
|
// Implementation Checks
|
|
73
77
|
function isAnyProtocol(object) {
|
|
74
78
|
return isOfflineProtocol(object) || isOnlineProtocol(object);
|
|
@@ -159,6 +163,10 @@ function isTransactionStatusChecker(protocol) {
|
|
|
159
163
|
return (0, interface_1.implementsInterface)(protocol, exports.transactionStatusCheckerSchema);
|
|
160
164
|
}
|
|
161
165
|
exports.isTransactionStatusChecker = isTransactionStatusChecker;
|
|
166
|
+
function supportsWalletConnect(protocol) {
|
|
167
|
+
return (0, interface_1.implementsInterface)(protocol, exports.walletConnectProtocolSchema);
|
|
168
|
+
}
|
|
169
|
+
exports.supportsWalletConnect = supportsWalletConnect;
|
|
162
170
|
// Identifier
|
|
163
171
|
var sha256hashShort = function (input) {
|
|
164
172
|
var hash = createHash('sha256');
|
package/utils/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/utils/protocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,aAAa;AACb,0FAA4F;
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/utils/protocol.ts"],"names":[],"mappings":";;;;;;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