@cityofzion/bs-multichain 3.0.5 → 3.1.0

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.
@@ -1,4 +1,4 @@
1
- import { TBSAccount, IBlockchainService, TUntilIndexRecord } from '@cityofzion/blockchain-service';
1
+ import { type TBSAccount, type IBlockchainService, type TUntilIndexRecord } from '@cityofzion/blockchain-service';
2
2
  export declare class BSAggregator<N extends string> {
3
3
  readonly blockchainServicesByName: Record<N, IBlockchainService<N>>;
4
4
  readonly blockchainServices: IBlockchainService<N>[];
@@ -1,8 +1,8 @@
1
- import { TBSAccount, TBalanceResponse, IBridgeOrchestrator, TBridgeOrchestratorEvents, TBridgeToken } from '@cityofzion/blockchain-service';
1
+ import { type TBSAccount, type TBalanceResponse, type IBridgeOrchestrator, type TBridgeOrchestratorEvents, type TBridgeToken } from '@cityofzion/blockchain-service';
2
2
  import { BSNeo3 } from '@cityofzion/bs-neo3';
3
3
  import { BSNeoX } from '@cityofzion/bs-neox';
4
4
  import TypedEmitter from 'typed-emitter';
5
- import { TNeo3NeoXBridgeOrchestratorInitParams, TNeo3NeoXBridgeOrchestratorWaitParams } from './types';
5
+ import type { TNeo3NeoXBridgeOrchestratorInitParams, TNeo3NeoXBridgeOrchestratorWaitParams } from './types';
6
6
  export declare class Neo3NeoXBridgeOrchestrator<N extends string> implements IBridgeOrchestrator<N> {
7
7
  #private;
8
8
  eventEmitter: TypedEmitter<TBridgeOrchestratorEvents<N>>;
@@ -1,4 +1,4 @@
1
- import { TBridgeToken } from '@cityofzion/blockchain-service';
1
+ import type { TBridgeToken } from '@cityofzion/blockchain-service';
2
2
  import { BSNeo3 } from '@cityofzion/bs-neo3';
3
3
  import { BSNeoX } from '@cityofzion/bs-neox';
4
4
  export type TNeo3NeoXBridgeOrchestratorInitParams<N extends string> = {
@@ -1,4 +1,4 @@
1
- import { TSimpleSwapApiCreateExchangeParams, TSimpleSwapApiCurrency, TSimpleSwapOrchestratorInitParams } from './types';
1
+ import type { TSimpleSwapApiCreateExchangeParams, TSimpleSwapApiCurrency, TSimpleSwapOrchestratorInitParams } from './types';
2
2
  export declare class SimpleSwapApi<N extends string> {
3
3
  #private;
4
4
  getCurrencies(options: TSimpleSwapOrchestratorInitParams<N>): Promise<TSimpleSwapApiCurrency<N>[]>;
@@ -13,7 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _SimpleSwapApi_instances, _SimpleSwapApi_tickersBySimpleSwapBlockchain, _SimpleSwapApi_apiInstance, _SimpleSwapApi_allCurrenciesMap, _SimpleSwapApi_api_get, _SimpleSwapApi_createAddressTemplateUrl, _SimpleSwapApi_createTxTemplateUrl, _SimpleSwapApi_getTokenFromCurrency;
16
+ var _SimpleSwapApi_instances, _SimpleSwapApi_tickersBySimpleSwapBlockchain, _SimpleSwapApi_apiInstance, _SimpleSwapApi_allCurrenciesMap, _SimpleSwapApi_api_get, _SimpleSwapApi_createAddressTemplateUrl, _SimpleSwapApi_createTransactionTemplateUrl, _SimpleSwapApi_getTokenFromCurrency;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.SimpleSwapApi = void 0;
19
19
  const axios_1 = __importDefault(require("axios"));
@@ -172,12 +172,12 @@ _SimpleSwapApi_tickersBySimpleSwapBlockchain = new WeakMap(), _SimpleSwapApi_api
172
172
  }, _SimpleSwapApi_createAddressTemplateUrl = function _SimpleSwapApi_createAddressTemplateUrl(blockchainService, explorer) {
173
173
  explorer = !explorer ? undefined : explorer.replace('{}', '{address}');
174
174
  if (blockchainService && (0, blockchain_service_1.hasExplorerService)(blockchainService))
175
- return blockchainService.explorerService.getAddressTemplateUrl() ?? explorer;
175
+ return blockchainService.explorerService.getAddressTemplateUrl() || explorer;
176
176
  return explorer;
177
- }, _SimpleSwapApi_createTxTemplateUrl = function _SimpleSwapApi_createTxTemplateUrl(blockchainService, explorer) {
177
+ }, _SimpleSwapApi_createTransactionTemplateUrl = function _SimpleSwapApi_createTransactionTemplateUrl(blockchainService, explorer) {
178
178
  explorer = !explorer ? undefined : explorer.replace('{}', '{txId}');
179
179
  if (blockchainService && (0, blockchain_service_1.hasExplorerService)(blockchainService))
180
- return blockchainService.explorerService.getTxTemplateUrl() ?? explorer;
180
+ return blockchainService.explorerService.getTransactionTemplateUrl() ?? explorer;
181
181
  return explorer;
182
182
  }, _SimpleSwapApi_getTokenFromCurrency = function _SimpleSwapApi_getTokenFromCurrency(currency, options) {
183
183
  const { network: simpleSwapBlockchain, ticker, precision } = currency;
@@ -226,7 +226,7 @@ _SimpleSwapApi_tickersBySimpleSwapBlockchain = new WeakMap(), _SimpleSwapApi_api
226
226
  validationExtra: currency.validationExtra,
227
227
  validationAddress: currency.validationAddress,
228
228
  addressTemplateUrl: __classPrivateFieldGet(this, _SimpleSwapApi_instances, "m", _SimpleSwapApi_createAddressTemplateUrl).call(this, blockchainService, currency.addressExplorer),
229
- txTemplateUrl: __classPrivateFieldGet(this, _SimpleSwapApi_instances, "m", _SimpleSwapApi_createTxTemplateUrl).call(this, blockchainService, currency.txExplorer),
229
+ txTemplateUrl: __classPrivateFieldGet(this, _SimpleSwapApi_instances, "m", _SimpleSwapApi_createTransactionTemplateUrl).call(this, blockchainService, currency.txExplorer),
230
230
  blockchain,
231
231
  };
232
232
  };
@@ -1,6 +1,6 @@
1
- import { TBSAccount, ISwapOrchestrator, TSwapOrchestratorEvents, TSwapResult, TSwapToken } from '@cityofzion/blockchain-service';
1
+ import { type TBSAccount, type ISwapOrchestrator, type TSwapOrchestratorEvents, type TSwapResponse, type TSwapToken } from '@cityofzion/blockchain-service';
2
2
  import TypedEmitter from 'typed-emitter';
3
- import { TSimpleSwapOrchestratorInitParams } from './types';
3
+ import type { TSimpleSwapOrchestratorInitParams } from './types';
4
4
  export declare class SimpleSwapOrchestrator<N extends string = string> implements ISwapOrchestrator<N> {
5
5
  #private;
6
6
  eventEmitter: TypedEmitter<TSwapOrchestratorEvents<N>>;
@@ -12,6 +12,6 @@ export declare class SimpleSwapOrchestrator<N extends string = string> implement
12
12
  setTokenToReceive(token: TSwapToken<N> | null): Promise<void>;
13
13
  setAddressToReceive(address: string | null): Promise<void>;
14
14
  setExtraIdToReceive(extraIdToReceive: string | null): Promise<void>;
15
- swap(): Promise<TSwapResult>;
15
+ swap(): Promise<TSwapResponse<N>>;
16
16
  calculateFee(): Promise<string>;
17
17
  }
@@ -147,11 +147,11 @@ class SimpleSwapOrchestrator {
147
147
  isNaN(__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToUse_get).value.decimals) ||
148
148
  (__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToReceive_get).value.hasExtraId &&
149
149
  (!__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_extraIdToReceive_get).valid || !__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_extraIdToReceive_get).value?.trim()))) {
150
- throw new Error('Not all required fields are set');
150
+ throw new blockchain_service_1.BSError('Not all required fields are set', 'MISSING_REQUIRED_FIELDS');
151
151
  }
152
- const result = {
152
+ const response = {
153
153
  id: '',
154
- txFrom: undefined,
154
+ transaction: undefined,
155
155
  log: undefined,
156
156
  };
157
157
  try {
@@ -163,10 +163,11 @@ class SimpleSwapOrchestrator {
163
163
  address: __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_addressToReceive_get).value,
164
164
  extraIdToReceive: __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_extraIdToReceive_get).value,
165
165
  });
166
- result.id = id;
167
- result.log = log;
166
+ response.id = id;
167
+ response.log = log;
168
168
  const service = __classPrivateFieldGet(this, _SimpleSwapOrchestrator_blockchainServicesByName, "f")[__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_accountToUse_get).value.blockchain];
169
- const [transactionHash] = await service.transfer({
169
+ // It'll always return one transaction because it has just one intent
170
+ const [transaction] = await service.transfer({
170
171
  senderAccount: __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_accountToUse_get).value,
171
172
  intents: [
172
173
  {
@@ -181,12 +182,12 @@ class SimpleSwapOrchestrator {
181
182
  },
182
183
  ],
183
184
  });
184
- result.txFrom = transactionHash;
185
+ response.transaction = transaction;
185
186
  }
186
187
  catch {
187
188
  // empty
188
189
  }
189
- return result;
190
+ return response;
190
191
  }
191
192
  async calculateFee() {
192
193
  if (!__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToUse_get).value ||
@@ -1,5 +1,5 @@
1
- import { ISwapService, TSwapServiceStatusResponse } from '@cityofzion/blockchain-service';
2
- export declare class SimpleSwapService<BSName extends string = string> implements ISwapService {
1
+ import type { ISwapService, TSwapServiceStatusResponse } from '@cityofzion/blockchain-service';
2
+ export declare class SimpleSwapService<N extends string = string> implements ISwapService {
3
3
  #private;
4
4
  constructor();
5
5
  getStatus(id: string): Promise<TSwapServiceStatusResponse>;
@@ -1,4 +1,4 @@
1
- import { IBlockchainService, TSwapToken } from '@cityofzion/blockchain-service';
1
+ import type { IBlockchainService, TSwapToken } from '@cityofzion/blockchain-service';
2
2
  export type TSimpleSwapOrchestratorInitParams<N extends string = string> = {
3
3
  blockchainServicesByName: Record<N, IBlockchainService<N>>;
4
4
  chainsByServiceName: Partial<Record<N, string[]>>;
@@ -1,8 +1,8 @@
1
- import { IBlockchainService, IBSWithWalletConnect } from '@cityofzion/blockchain-service';
1
+ import { type IBlockchainService, type IBSWithWalletConnect } from '@cityofzion/blockchain-service';
2
2
  import { ErrorResponse } from '@walletconnect/jsonrpc-utils';
3
3
  import type { PendingRequestTypes, SessionTypes } from '@walletconnect/types';
4
4
  import { SdkErrorKey } from '@walletconnect/utils';
5
- import { type TWalletKitHelperFilterSessionsParams, type TWalletKitHelperGetProposalDetailsParams, type TWalletKitHelperGetSessionDetailsParams, type TWalletKitHelperProcessRequestParams, type TWalletKitHelperProposalDetails, type TWalletKitHelperSessionDetails, type TWalletKitHelperGetProposalServicesParams } from './types';
5
+ import type { TWalletKitHelperFilterSessionsParams, TWalletKitHelperGetProposalDetailsParams, TWalletKitHelperGetSessionDetailsParams, TWalletKitHelperProcessRequestParams, TWalletKitHelperProposalDetails, TWalletKitHelperSessionDetails, TWalletKitHelperGetProposalServicesParams } from './types';
6
6
  export declare class WalletKitHelper {
7
7
  static getProposalDetails<N extends string>({ address, proposal, service, }: TWalletKitHelperGetProposalDetailsParams<N>): TWalletKitHelperProposalDetails<N>;
8
8
  static getProposalServices<N extends string>({ proposal, services }: TWalletKitHelperGetProposalServicesParams<N>): (IBlockchainService<N, string> & IBSWithWalletConnect<N>)[];
@@ -1,5 +1,5 @@
1
- import { IBlockchainService, IBSWithWalletConnect, TBSAccount } from '@cityofzion/blockchain-service';
2
- import { PendingRequestTypes, ProposalTypes, SessionTypes } from '@walletconnect/types';
1
+ import type { IBlockchainService, IBSWithWalletConnect, TBSAccount } from '@cityofzion/blockchain-service';
2
+ import type { PendingRequestTypes, ProposalTypes, SessionTypes } from '@walletconnect/types';
3
3
  export type TWalletKitHelperGetProposalDetailsParams<N extends string = string> = {
4
4
  proposal: ProposalTypes.Struct;
5
5
  address: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-multichain",
3
- "version": "3.0.5",
3
+ "version": "3.1.0",
4
4
  "repository": "https://github.com/CityOfZion/blockchain-services",
5
5
  "license": "GPL-3.0-only",
6
6
  "author": "Coz",
@@ -10,22 +10,22 @@
10
10
  "/dist"
11
11
  ],
12
12
  "dependencies": {
13
- "@walletconnect/jsonrpc-utils": "~1.0.8",
14
13
  "@walletconnect/utils": "~2.21.9",
15
- "axios": "~1.12.2",
16
- "@cityofzion/blockchain-service": "3.0.5"
14
+ "@walletconnect/jsonrpc-utils": "~1.0.8",
15
+ "axios": "~1.13.5",
16
+ "@cityofzion/blockchain-service": "3.1.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "~24.5.2",
20
20
  "@walletconnect/types": "~2.21.9",
21
21
  "dotenv": "~17.3.1",
22
- "eslint": "~9.36.0",
22
+ "eslint": "~9.37.0",
23
23
  "typed-emitter": "~2.1.0",
24
24
  "typescript": "~5.9.2",
25
25
  "vitest": "~4.0.18",
26
- "@cityofzion/bs-ethereum": "3.0.5",
27
- "@cityofzion/bs-neo3": "3.0.5",
28
- "@cityofzion/bs-neox": "3.0.5"
26
+ "@cityofzion/bs-ethereum": "3.1.0",
27
+ "@cityofzion/bs-neo3": "3.1.0",
28
+ "@cityofzion/bs-neox": "3.1.0"
29
29
  },
30
30
  "scripts": {
31
31
  "build": "rm -rf ./dist && npm run typecheck && tsc --project tsconfig.build.json",