@airgap/stellar 0.13.41-beta.0 → 0.13.41-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airgap/stellar",
3
- "version": "0.13.41-beta.0",
3
+ "version": "0.13.41-beta.11",
4
4
  "description": "The @airgap/aeternity is an Aeternity implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
5
5
  "keywords": [
6
6
  "airgap",
@@ -24,15 +24,15 @@
24
24
  "lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
25
25
  "lint-ci": "tslint -t json -o ../../lint-reports/aeternity.json --project . || true",
26
26
  "lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different",
27
- "test": "",
28
- "test-ci": "",
27
+ "test": "TS_NODE_PROJECT='./test/tsconfig.json' nyc mocha --bail --require ts-node/register --require tsconfig-paths/register --require source-map-support/register --full-trace --delay --timeout 40000 ./test/**/**.spec.ts",
28
+ "test-ci": "nyc --reporter=lcov npm test",
29
29
  "browserify": "browserify ./dist/index.js -s airgapCoinLibAeternity > ./dist/airgap-coinlib-aeternity.min.js"
30
30
  },
31
31
  "author": "Papers AG <contact@papers.ch> (https://papers.ch)",
32
32
  "dependencies": {
33
- "@airgap/coinlib-core": "^0.13.41-beta.0",
34
- "@airgap/module-kit": "^0.13.41-beta.0",
35
- "@airgap/serializer": "^0.13.41-beta.0",
33
+ "@airgap/coinlib-core": "^0.13.41-beta.11",
34
+ "@airgap/module-kit": "^0.13.41-beta.11",
35
+ "@airgap/serializer": "^0.13.41-beta.11",
36
36
  "@stellar/stellar-sdk": "^13.3.0"
37
37
  },
38
38
  "localDependencies": {},
@@ -2,8 +2,7 @@ import { PublicKey } from '@airgap/module-kit';
2
2
  export declare class StellarAddress {
3
3
  private readonly value;
4
4
  private constructor();
5
- static from(publicKey: string | PublicKey): StellarAddress;
5
+ static from(publicKey: PublicKey): StellarAddress;
6
6
  asString(): string;
7
7
  toPublicKey(): PublicKey;
8
- private static parse;
9
8
  }
@@ -8,8 +8,12 @@ var StellarAddress = /** @class */ (function () {
8
8
  this.value = value;
9
9
  }
10
10
  StellarAddress.from = function (publicKey) {
11
- var _publicKey = typeof publicKey === 'string' ? StellarAddress.parse(publicKey) : publicKey;
12
- return new StellarAddress(_publicKey.value);
11
+ if (stellar_sdk_1.StrKey.isValidEd25519PublicKey(publicKey.value)) {
12
+ return new StellarAddress(publicKey.value);
13
+ }
14
+ var rawPublicKey = Buffer.from(publicKey.value, 'hex');
15
+ var stellarAddress = stellar_sdk_1.StrKey.encodeEd25519PublicKey(rawPublicKey);
16
+ return new StellarAddress(stellarAddress);
13
17
  };
14
18
  StellarAddress.prototype.asString = function () {
15
19
  return this.value;
@@ -17,13 +21,6 @@ var StellarAddress = /** @class */ (function () {
17
21
  StellarAddress.prototype.toPublicKey = function () {
18
22
  return (0, module_kit_1.newPublicKey)(this.value, 'encoded');
19
23
  };
20
- StellarAddress.parse = function (value) {
21
- // Validate it's a proper Stellar G-address
22
- if (!stellar_sdk_1.StrKey.isValidEd25519PublicKey(value)) {
23
- throw new Error('Invalid Stellar address');
24
- }
25
- return (0, module_kit_1.newPublicKey)(value, 'encoded');
26
- };
27
24
  return StellarAddress;
28
25
  }());
29
26
  exports.StellarAddress = StellarAddress;
@@ -1 +1 @@
1
- {"version":3,"file":"StellarAddress.js","sourceRoot":"","sources":["../../../src/v1/data/StellarAddress.ts"],"names":[],"mappings":";;;AAAA,iDAA4D;AAE5D,oDAA6C;AAE7C;IACE,wBAAqC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAExC,mBAAI,GAAlB,UAAmB,SAA6B;QAC9C,IAAM,UAAU,GAAc,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAE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AAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAC5C,CAAC;IACH,qBAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBY,wCAAc"}
package/v1/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { StellarBlockExplorer } from './block-explorer/StellarBlockExplorer';
2
2
  import { StellarModule } from './module/StellarModule';
3
+ import { createStellarAssetProtocol, StellarAssetProtocol } from './protocol/stellarAssets/StellarAsset';
3
4
  import { StellarProtocol, createStellarProtocol, createStellarProtocolOptions } from './protocol/StellarProtocol';
4
5
  import { StellarTransactionSignRequest } from './serializer/v3/schemas/definitions/transaction-sign-request-stellar';
5
6
  import { StellarTransactionSignResponse } from './serializer/v3/schemas/definitions/transaction-sign-response-stellar';
6
7
  import { StellarCryptoConfiguration } from './types/crypto';
7
- import { StellarProtocolNetwork, StellarProtocolOptions, StellarUnits } from './types/protocol';
8
+ import { StellarAssetMetadata, StellarProtocolNetwork, StellarProtocolOptions, StellarSigner, StellarUnits } from './types/protocol';
8
9
  import { StellarSignedTransaction, StellarUnsignedTransaction } from './types/transaction';
9
10
  export { StellarModule };
10
- export { StellarProtocol, createStellarProtocol, createStellarProtocolOptions };
11
+ export { StellarProtocol, createStellarProtocol, createStellarProtocolOptions, createStellarAssetProtocol, StellarAssetProtocol };
11
12
  export { StellarBlockExplorer };
12
- export { StellarCryptoConfiguration, StellarUnits, StellarProtocolOptions, StellarProtocolNetwork, StellarUnsignedTransaction, StellarSignedTransaction };
13
+ export { StellarCryptoConfiguration, StellarUnits, StellarProtocolOptions, StellarProtocolNetwork, StellarUnsignedTransaction, StellarSignedTransaction, StellarAssetMetadata, StellarSigner };
13
14
  export { StellarTransactionSignRequest, StellarTransactionSignResponse };
package/v1/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StellarBlockExplorer = exports.createStellarProtocolOptions = exports.createStellarProtocol = exports.StellarModule = void 0;
3
+ exports.StellarBlockExplorer = exports.createStellarAssetProtocol = exports.createStellarProtocolOptions = exports.createStellarProtocol = exports.StellarModule = void 0;
4
4
  var StellarBlockExplorer_1 = require("./block-explorer/StellarBlockExplorer");
5
5
  Object.defineProperty(exports, "StellarBlockExplorer", { enumerable: true, get: function () { return StellarBlockExplorer_1.StellarBlockExplorer; } });
6
6
  var StellarModule_1 = require("./module/StellarModule");
7
7
  Object.defineProperty(exports, "StellarModule", { enumerable: true, get: function () { return StellarModule_1.StellarModule; } });
8
+ var StellarAsset_1 = require("./protocol/stellarAssets/StellarAsset");
9
+ Object.defineProperty(exports, "createStellarAssetProtocol", { enumerable: true, get: function () { return StellarAsset_1.createStellarAssetProtocol; } });
8
10
  var StellarProtocol_1 = require("./protocol/StellarProtocol");
9
11
  Object.defineProperty(exports, "createStellarProtocol", { enumerable: true, get: function () { return StellarProtocol_1.createStellarProtocol; } });
10
12
  Object.defineProperty(exports, "createStellarProtocolOptions", { enumerable: true, get: function () { return StellarProtocol_1.createStellarProtocolOptions; } });
package/v1/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAA4E;AAmBnE,qGAnBA,2CAAoB,OAmBA;AAlB7B,wDAAsD;AAU7C,8FAVA,6BAAa,OAUA;AATtB,8DAAiH;AAavF,sGAbA,uCAAqB,OAaA;AAAE,6GAbA,8CAA4B,OAaA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,8EAA4E;AAoBnE,qGApBA,2CAAoB,OAoBA;AAnB7B,wDAAsD;AAW7C,8FAXA,6BAAa,OAWA;AAVtB,sEAAwG;AAczB,2GAdtE,yCAA0B,OAcsE;AAbzG,8DAAiH;AAavF,sGAbA,uCAAqB,OAaA;AAAE,6GAbA,8CAA4B,OAaA"}
@@ -0,0 +1,3 @@
1
+ import { StellarAssetMetadata } from '../types/protocol';
2
+ export declare const stellarAssets: Record<string, StellarAssetMetadata>;
3
+ export declare const stellarAssetsIdentifiers: string[];
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stellarAssetsIdentifiers = exports.stellarAssets = void 0;
4
+ exports.stellarAssets = {
5
+ 'stellar-asset-usdc': {
6
+ assetCode: 'USDC',
7
+ name: 'Stellar USD Coin',
8
+ marketSymbol: 'usdc',
9
+ issuer: 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',
10
+ decimals: 7,
11
+ identifier: 'stellar-asset-usdc'
12
+ },
13
+ 'stellar-asset-eurc': {
14
+ assetCode: 'EURC',
15
+ name: 'Stellar Euro Coin',
16
+ marketSymbol: 'eurc',
17
+ issuer: 'GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2',
18
+ decimals: 7,
19
+ identifier: 'stellar-asset-eurc'
20
+ },
21
+ 'stellar-asset-velo': {
22
+ assetCode: 'VELO',
23
+ name: 'Velo Token',
24
+ marketSymbol: 'velo',
25
+ issuer: 'GDM4RQUQQUVSKQA7S6EM7XBZP3FCGH4Q7CL6TABQ7B2BEJ5ERARM2M5M',
26
+ decimals: 7,
27
+ identifier: 'stellar-asset-velo'
28
+ },
29
+ 'stellar-asset-shx': {
30
+ assetCode: 'SHX',
31
+ name: 'Stronghold Token',
32
+ marketSymbol: 'shx',
33
+ issuer: 'GDSTRSHXHGJ7ZIVRBXEYE5Q74XUVCUSEKEBR7UCHEUUEK72N7I7KJ6JH',
34
+ decimals: 7,
35
+ identifier: 'stellar-asset-shx'
36
+ },
37
+ 'stellar-asset-aqua': {
38
+ assetCode: 'AQUA',
39
+ name: 'Aqua Token',
40
+ marketSymbol: 'aqua',
41
+ issuer: 'GBNZILSTVQZ4R7IKQDGHYGY2QXL5QOFJYQMXPKWRRM5PAV7Y4M67AQUA',
42
+ decimals: 7,
43
+ identifier: 'stellar-asset-aqua'
44
+ }
45
+ };
46
+ exports.stellarAssetsIdentifiers = Object.keys(exports.stellarAssets);
47
+ //# sourceMappingURL=StellarAssets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StellarAssets.js","sourceRoot":"","sources":["../../../src/v1/module/StellarAssets.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAyC;IACjE,oBAAoB,EAAE;QACpB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,kBAAkB;QACxB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,0DAA0D;QAClE,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,oBAAoB;KACjC;IACD,oBAAoB,EAAE;QACpB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,mBAAmB;QACzB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,0DAA0D;QAClE,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,oBAAoB;KACjC;IACD,oBAAoB,EAAE;QACpB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,0DAA0D;QAClE,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,oBAAoB;KACjC;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,kBAAkB;QACxB,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,0DAA0D;QAClE,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,mBAAmB;KAChC;IACD,oBAAoB,EAAE;QACpB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,0DAA0D;QAClE,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,oBAAoB;KACjC;CACF,CAAA;AAEY,QAAA,wBAAwB,GAAa,MAAM,CAAC,IAAI,CAAC,qBAAa,CAAC,CAAA"}
@@ -1,17 +1,14 @@
1
1
  import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
2
- import { MainProtocolSymbols } from '@airgap/coinlib-core';
3
2
  import { StellarProtocolNetwork } from '../types/protocol';
4
- declare type SupportedProtocols = MainProtocolSymbols.XLM;
5
3
  export declare class StellarModule implements AirGapModule<{
6
- Protocols: SupportedProtocols;
7
4
  ProtocolNetwork: StellarProtocolNetwork;
8
5
  }> {
9
6
  private readonly networkRegistries;
10
- readonly supportedProtocols: Record<SupportedProtocols, ProtocolConfiguration>;
11
- createOfflineProtocol(identifier: SupportedProtocols): Promise<AirGapOfflineProtocol | undefined>;
12
- createOnlineProtocol(identifier: SupportedProtocols, networkOrId?: StellarProtocolNetwork | string): Promise<AirGapOnlineProtocol | undefined>;
13
- createBlockExplorer(identifier: SupportedProtocols, networkOrId?: StellarProtocolNetwork | string): Promise<AirGapBlockExplorer | undefined>;
7
+ readonly supportedProtocols: Record<string, ProtocolConfiguration>;
8
+ constructor();
9
+ createOfflineProtocol(identifier: string): Promise<AirGapOfflineProtocol | undefined>;
10
+ createOnlineProtocol(identifier: string, networkOrId?: StellarProtocolNetwork | string): Promise<AirGapOnlineProtocol | undefined>;
11
+ createBlockExplorer(identifier: string, networkOrId?: StellarProtocolNetwork | string): Promise<AirGapBlockExplorer | undefined>;
14
12
  createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
15
13
  private createProtocol;
16
14
  }
17
- export {};
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -43,14 +54,18 @@ var errors_1 = require("@airgap/coinlib-core/errors");
43
54
  var StellarBlockExplorer_1 = require("../block-explorer/StellarBlockExplorer");
44
55
  var StellarProtocol_1 = require("../protocol/StellarProtocol");
45
56
  var serializer_companion_1 = require("../serializer/v3/serializer-companion");
57
+ var StellarAssets_1 = require("./StellarAssets");
58
+ var StellarAsset_1 = require("../protocol/stellarAssets/StellarAsset");
46
59
  var StellarModule = /** @class */ (function () {
47
60
  function StellarModule() {
48
61
  var _a;
49
- this.networkRegistries = (_a = {},
50
- _a[coinlib_core_1.MainProtocolSymbols.XLM] = new module_kit_1.ModuleNetworkRegistry({
51
- supportedNetworks: [StellarProtocol_1.STELLAR_MAINNET_PROTOCOL_NETWORK]
52
- }),
53
- _a);
62
+ var stellarNetworkRegistry = new module_kit_1.ModuleNetworkRegistry({
63
+ supportedNetworks: [StellarProtocol_1.STELLAR_MAINNET_PROTOCOL_NETWORK]
64
+ });
65
+ this.networkRegistries = __assign((_a = {}, _a[coinlib_core_1.MainProtocolSymbols.STELLAR] = stellarNetworkRegistry, _a), StellarAssets_1.stellarAssetsIdentifiers.reduce(function (obj, next) {
66
+ var _a;
67
+ return Object.assign(obj, (_a = {}, _a[next] = stellarNetworkRegistry, _a));
68
+ }, {}));
54
69
  this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
55
70
  }
56
71
  StellarModule.prototype.createOfflineProtocol = function (identifier) {
@@ -94,12 +109,14 @@ var StellarModule = /** @class */ (function () {
94
109
  });
95
110
  };
96
111
  StellarModule.prototype.createProtocol = function (identifier, network) {
97
- switch (identifier) {
98
- case coinlib_core_1.MainProtocolSymbols.XLM:
99
- return (0, StellarProtocol_1.createStellarProtocol)({ network: network });
100
- default:
101
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported."));
112
+ if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR) {
113
+ return (0, StellarProtocol_1.createStellarProtocol)({ network: network });
114
+ }
115
+ if (StellarAssets_1.stellarAssets[identifier] !== undefined) {
116
+ var tokenMetadata = StellarAssets_1.stellarAssets[identifier];
117
+ return (0, StellarAsset_1.createStellarAssetProtocol)(tokenMetadata);
102
118
  }
119
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SERIALIZER, "Protocol ".concat(identifier, " not supported."));
103
120
  };
104
121
  return StellarModule;
105
122
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"StellarModule.js","sourceRoot":"","sources":["../../../src/v1/module/StellarModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAW2B;AAC3B,qDAAkE;AAClE,sDAAqE;AAErE,+EAA6E;AAC7E,+DAAqG;AACrG,8EAAoF;AAKpF;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,GAAG,IAAG,IAAI,kCAAqB,CAAC;gBACnD,iBAAiB,EAAE,CAAC,kDAAgC,CAAC;aACtD,CAAC;gBACH;QAEe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IA8C1I,CAAC;IA5Cc,6CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,4CAAoB,GAAjC,UACE,UAA8B,EAC9B,WAA6C;;;;;gBAEvC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,q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AAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,OAAO,EAAE,uCAAuC,CAAC,CAAA;iBAC3F;gBAED,sBAAO,IAAI,2CAAoB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAA;;;KAC1D;IAEY,mDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,mDAA4B,EAAE,EAAA;;;KAC1C;IAEO,sCAAc,GAAtB,UAAuB,UAAkB,EAAE,OAAyB;QAClE,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,EAAE;YAC9C,OAAO,IAAA,uCAAqB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;SAC1C;QAED,IAAI,6BAAa,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;YAC3C,IAAM,aAAa,GAAyB,6BAAa,CAAC,UAAU,CAAC,CAAA;YAErE,OAAO,IAAA,yCAA0B,EAAC,aAAa,CAAC,CAAA;SACjD;QAED,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,UAAU,EAAE,mBAAY,UAAU,oBAAiB,CAAC,CAAA;IAC/F,CAAC;IACH,oBAAC;AAAD,CAAC,AArED,IAqEC;AArEY,sCAAa"}
@@ -1,6 +1,7 @@
1
- import { Address, AirGapProtocol, AirGapTransaction, Balance, CryptoDerivative, FeeDefaults, KeyPair, ProtocolMetadata, PublicKey, RecursivePartial, SecretKey, TransactionFullConfiguration, TransactionDetails, AirGapTransactionsWithCursor, Amount, TransactionSimpleConfiguration } from '@airgap/module-kit';
1
+ import { Address, AirGapProtocol, AirGapTransaction, Balance, CryptoDerivative, FeeDefaults, KeyPair, ProtocolMetadata, PublicKey, RecursivePartial, SecretKey, TransactionFullConfiguration, TransactionDetails, AirGapTransactionsWithCursor, Amount, TransactionSimpleConfiguration, WalletConnectRequest } from '@airgap/module-kit';
2
+ import { Transaction, Horizon } from '@stellar/stellar-sdk';
2
3
  import { StellarCryptoConfiguration } from '../types/crypto';
3
- import { StellarProtocolNetwork, StellarProtocolOptions, StellarUnits } from '../types/protocol';
4
+ import { StellarProtocolNetwork, StellarProtocolOptions, StellarSigner, StellarThresholds, StellarUnits } from '../types/protocol';
4
5
  import { StellarSignedTransaction, StellarTransactionCursor, StellarUnsignedTransaction } from '../types/transaction';
5
6
  export interface StellarProtocol extends AirGapProtocol<{
6
7
  AddressResult: Address;
@@ -11,11 +12,30 @@ export interface StellarProtocol extends AirGapProtocol<{
11
12
  Units: StellarUnits;
12
13
  FeeEstimation: FeeDefaults<StellarUnits>;
13
14
  UnsignedTransaction: StellarUnsignedTransaction;
14
- }, 'FetchDataForAddress'> {
15
+ }, 'FetchDataForAddress', 'WalletConnect', 'Multisig'> {
16
+ server: Horizon.Server;
17
+ options: StellarProtocolOptions;
18
+ getDetailsFromEncodedGenericTransaction(transaction: string): Promise<Transaction>;
19
+ getSigners(publicKey: PublicKey): Promise<StellarSigner[]>;
20
+ adjustSigner(masterPublicky: PublicKey, signerPublicKey: PublicKey, weight: number, lowThreshold: number, medThreshold: number, highThreshold: number): Promise<StellarUnsignedTransaction>;
21
+ getThresholds(publicKey: PublicKey): Promise<StellarThresholds>;
22
+ getThresholdReachedStatus(transaction: string): Promise<{
23
+ thresholdRequired: number;
24
+ currentThreshold: number;
25
+ }>;
15
26
  }
16
27
  export declare class StellarProtocolImpl implements StellarProtocol {
17
- private readonly options;
28
+ readonly options: StellarProtocolOptions;
29
+ readonly server: Horizon.Server;
18
30
  constructor(options?: RecursivePartial<StellarProtocolOptions>);
31
+ getMultisigStatus(publicKey: PublicKey): Promise<boolean>;
32
+ getSigners(publicKey: PublicKey): Promise<StellarSigner[]>;
33
+ getThresholds(publicKey: PublicKey): Promise<StellarThresholds>;
34
+ getThresholdReachedStatus(transaction: string): Promise<{
35
+ thresholdRequired: number;
36
+ currentThreshold: number;
37
+ }>;
38
+ adjustSigner(masterPublicky: PublicKey, signerPublicKey: PublicKey, weight: number, lowThreshold: number, medThreshold: number, highThreshold: number): Promise<StellarUnsignedTransaction>;
19
39
  getTransactionsForPublicKey(publicKey: PublicKey, limit: number, cursor?: StellarTransactionCursor | undefined): Promise<AirGapTransactionsWithCursor<StellarTransactionCursor, StellarUnits>>;
20
40
  getTransactionsForAddress(address: Address, limit: number, cursor?: StellarTransactionCursor | undefined): Promise<AirGapTransactionsWithCursor<StellarTransactionCursor, StellarUnits>>;
21
41
  getTransactionMaxAmountWithPublicKey(publicKey: PublicKey, to: Address[], configuration?: TransactionFullConfiguration<StellarUnits>): Promise<Amount<StellarUnits>>;
@@ -26,6 +46,7 @@ export declare class StellarProtocolImpl implements StellarProtocol {
26
46
  getMetadata(): Promise<ProtocolMetadata<StellarUnits>>;
27
47
  getAddressFromPublicKey(publicKey: PublicKey): Promise<string>;
28
48
  getDetailsFromTransaction(transaction: StellarSignedTransaction | StellarUnsignedTransaction, _publicKey: PublicKey): Promise<AirGapTransaction<StellarUnits>[]>;
49
+ getDetailsFromEncodedGenericTransaction(transaction: string): Promise<Transaction>;
29
50
  private getDetailsFromEncodedTransaction;
30
51
  private readonly cryptoConfiguration;
31
52
  getCryptoConfiguration(): Promise<StellarCryptoConfiguration>;
@@ -36,6 +57,8 @@ export declare class StellarProtocolImpl implements StellarProtocol {
36
57
  getBalanceOfAddress(address: string): Promise<Balance<StellarUnits>>;
37
58
  prepareTransactionWithPublicKey(publicKey: PublicKey, details: TransactionDetails<StellarUnits>[], configuration?: TransactionFullConfiguration<StellarUnits>): Promise<StellarUnsignedTransaction>;
38
59
  broadcastTransaction(transaction: StellarSignedTransaction): Promise<string>;
60
+ getWalletConnectChain(): Promise<string>;
61
+ prepareWalletConnectTransactionWithPublicKey(publicKey: PublicKey, request: WalletConnectRequest): Promise<StellarUnsignedTransaction>;
39
62
  }
40
63
  export declare function createStellarProtocol(options?: RecursivePartial<StellarProtocolOptions>): StellarProtocol;
41
64
  export declare const STELLAR_MAINNET_PROTOCOL_NETWORK: StellarProtocolNetwork;