@cityofzion/bs-ethereum 3.1.3 → 3.1.4

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,9 +1,9 @@
1
- import { type TBSAccount, type TTransferIntent, type TBSToken, type TTransferParams, type TGetLedgerTransport, type ITokenService, type TBSNetwork, type IBlockchainDataService, type IExchangeDataService, type INftDataService, type IExplorerService, type TPingNetworkResponse, type IWalletConnectService, type IFullTransactionsDataService, type TTransactionDefault } from '@cityofzion/blockchain-service';
1
+ import { type TBSAccount, type TTransferIntent, type TBSToken, type TTransferParams, type TGetLedgerTransport, type ITokenService, type TBSNetwork, type IBlockchainDataService, type IExchangeDataService, type INftDataService, type IExplorerService, type TPingNetworkResponse, type IWalletConnectService, type IFullTransactionsDataService, type TTransactionDefault, type TBSNetworkId } from '@cityofzion/blockchain-service';
2
2
  import { ethers } from 'ethers';
3
3
  import { EthersLedgerServiceEthereum } from './services/ledger/EthersLedgerServiceEthereum';
4
- import type { IBSEthereum, TBSEthereumNetworkId, TSupportedEVM } from './types';
4
+ import type { IBSEthereum, TBSEthereumName, TBSEthereumNetworkId } from './types';
5
5
  import { TypedDataSigner } from '@ethersproject/abstract-signer';
6
- export declare class BSEthereum<N extends string = string, A extends string = TBSEthereumNetworkId> implements IBSEthereum<N, A> {
6
+ export declare class BSEthereum<N extends string = TBSEthereumName, A extends TBSNetworkId = TBSEthereumNetworkId> implements IBSEthereum<N, A> {
7
7
  #private;
8
8
  readonly name: N;
9
9
  readonly bipDerivationPath: string;
@@ -16,20 +16,20 @@ export declare class BSEthereum<N extends string = string, A extends string = TB
16
16
  networkUrls: string[];
17
17
  readonly defaultNetwork: TBSNetwork<A>;
18
18
  readonly availableNetworks: TBSNetwork<A>[];
19
- blockchainDataService: IBlockchainDataService<N>;
19
+ blockchainDataService: IBlockchainDataService;
20
20
  exchangeDataService: IExchangeDataService;
21
21
  ledgerService: EthersLedgerServiceEthereum<N>;
22
22
  nftDataService: INftDataService;
23
23
  explorerService: IExplorerService;
24
24
  tokenService: ITokenService;
25
25
  walletConnectService: IWalletConnectService<N>;
26
- fullTransactionsDataService: IFullTransactionsDataService<N>;
27
- constructor(name: N, evm?: TSupportedEVM, network?: TBSNetwork<A>, getLedgerTransport?: TGetLedgerTransport<N>);
28
- protected _buildTransferParams(intent: TTransferIntent): Promise<{
26
+ fullTransactionsDataService: IFullTransactionsDataService;
27
+ constructor(name: N, network?: TBSNetwork<A>, getLedgerTransport?: TGetLedgerTransport<N>);
28
+ _generateSigner(account: TBSAccount<N>): Promise<ethers.Signer & TypedDataSigner>;
29
+ _buildTransferParams(intent: TTransferIntent): Promise<{
29
30
  transactionParams: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
30
31
  gasPrice: ethers.BigNumber;
31
32
  }>;
32
- generateSigner(account: TBSAccount<N>): Promise<ethers.Signer & TypedDataSigner>;
33
33
  setNetwork(network: TBSNetwork<A>): void;
34
34
  pingNetwork(url: string): Promise<TPingNetworkResponse>;
35
35
  validateAddress(address: string): boolean;
@@ -41,7 +41,7 @@ export declare class BSEthereum<N extends string = string, A extends string = TB
41
41
  generateAccountFromPublicKey(publicKey: string): Promise<TBSAccount<N>>;
42
42
  decrypt(json: string, password: string): Promise<TBSAccount<N>>;
43
43
  encrypt(key: string, password: string): Promise<string>;
44
- transfer({ senderAccount, intents }: TTransferParams<N>): Promise<TTransactionDefault<N>[]>;
44
+ transfer({ senderAccount, intents }: TTransferParams<N>): Promise<TTransactionDefault[]>;
45
45
  calculateTransferFee(params: TTransferParams<N>): Promise<string>;
46
46
  resolveNameServiceDomain(domainName: string): Promise<string>;
47
47
  }
@@ -60,19 +60,35 @@ const WalletConnectServiceEthereum_1 = require("./services/wallet-connect/Wallet
60
60
  const axios_1 = __importDefault(require("axios"));
61
61
  const MoralisFullTransactionsDataServiceEthereum_1 = require("./services/full-transactions-data/MoralisFullTransactionsDataServiceEthereum");
62
62
  class BSEthereum {
63
- constructor(name, evm, network, getLedgerTransport) {
63
+ constructor(name, network, getLedgerTransport) {
64
64
  _BSEthereum_instances.add(this);
65
65
  this.isMultiTransferSupported = false;
66
66
  this.isCustomNetworkSupported = false;
67
67
  this.name = name;
68
68
  this.ledgerService = new EthersLedgerServiceEthereum_1.EthersLedgerServiceEthereum(this, getLedgerTransport);
69
69
  this.bipDerivationPath = BSEthereumConstants_1.BSEthereumConstants.DEFAULT_BIP_DERIVATION_PATH;
70
- if (!evm)
70
+ const networks = BSEthereumConstants_1.BSEthereumConstants.NETWORKS_BY_EVM[name];
71
+ // This case is hit when the user tries to initialize the service with a custom network that is not in our predefined list. We want to allow that, but in that case we won't have the default network and available networks list.
72
+ if (!networks || !networks.length) {
71
73
  return;
72
- this.availableNetworks = BSEthereumConstants_1.BSEthereumConstants.NETWORKS_BY_EVM[evm];
74
+ }
75
+ this.availableNetworks = networks;
73
76
  this.defaultNetwork = this.availableNetworks.find(network => network.type === 'mainnet');
74
77
  this.setNetwork(network ?? this.defaultNetwork);
75
78
  }
79
+ async _generateSigner(account) {
80
+ const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
81
+ if (account.isHardware) {
82
+ if (!this.ledgerService.getLedgerTransport)
83
+ throw new Error('You must provide getLedgerTransport function to use Ledger');
84
+ if (!account.bipPath) {
85
+ throw new Error('Account must have BIP path to use Ledger');
86
+ }
87
+ const ledgerTransport = await this.ledgerService.getLedgerTransport(account);
88
+ return this.ledgerService.getSigner(ledgerTransport, account.bipPath, provider);
89
+ }
90
+ return new ethers_1.ethers.Wallet(account.key, provider);
91
+ }
76
92
  async _buildTransferParams(intent) {
77
93
  const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
78
94
  const amount = ethersBigNumber.parseFixed(intent.amount, intent.token.decimals);
@@ -100,19 +116,6 @@ class BSEthereum {
100
116
  gasPrice,
101
117
  };
102
118
  }
103
- async generateSigner(account) {
104
- const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
105
- if (account.isHardware) {
106
- if (!this.ledgerService.getLedgerTransport)
107
- throw new Error('You must provide getLedgerTransport function to use Ledger');
108
- if (!account.bipPath) {
109
- throw new Error('Account must have BIP path to use Ledger');
110
- }
111
- const ledgerTransport = await this.ledgerService.getLedgerTransport(account);
112
- return this.ledgerService.getSigner(ledgerTransport, account.bipPath, provider);
113
- }
114
- return new ethers_1.ethers.Wallet(account.key, provider);
115
- }
116
119
  setNetwork(network) {
117
120
  const networkUrls = BSEthereumConstants_1.BSEthereumConstants.RPC_LIST_BY_NETWORK_ID[network.id] || [];
118
121
  const isValidNetwork = blockchain_service_1.BSUtilsHelper.validateNetwork(network, this.availableNetworks, networkUrls);
@@ -126,7 +129,7 @@ class BSEthereum {
126
129
  this.explorerService = new BlockscoutESEthereum_1.BlockscoutESEthereum(this);
127
130
  this.exchangeDataService = new MoralisEDSEthereum_1.MoralisEDSEthereum(this);
128
131
  this.blockchainDataService = new MoralisBDSEthereum_1.MoralisBDSEthereum(this);
129
- this.tokenService = new TokenServiceEthereum_1.TokenServiceEthereum();
132
+ this.tokenService = new TokenServiceEthereum_1.TokenServiceEthereum(this);
130
133
  this.walletConnectService = new WalletConnectServiceEthereum_1.WalletConnectServiceEthereum(this);
131
134
  this.fullTransactionsDataService = new MoralisFullTransactionsDataServiceEthereum_1.MoralisFullTransactionsDataServiceEthereum(this);
132
135
  }
@@ -209,10 +212,9 @@ class BSEthereum {
209
212
  return wallet.encrypt(password);
210
213
  }
211
214
  async transfer({ senderAccount, intents }) {
212
- const signer = await this.generateSigner(senderAccount);
215
+ const signer = await this._generateSigner(senderAccount);
213
216
  const { address } = senderAccount;
214
217
  const addressUrl = this.explorerService.buildAddressUrl(address);
215
- const nativeTokenHash = BSEthereumHelper_1.BSEthereumHelper.getNativeAsset(this.network).hash;
216
218
  const transactions = [];
217
219
  let error;
218
220
  for (const intent of intents) {
@@ -236,13 +238,11 @@ class BSEthereum {
236
238
  if (txId) {
237
239
  const { receiverAddress, token } = intent;
238
240
  const tokenHash = token.hash;
239
- const isNativeToken = this.tokenService.predicateByHash(nativeTokenHash, tokenHash);
240
241
  transactions.push({
241
242
  txId,
242
243
  txIdUrl: this.explorerService.buildTransactionUrl(txId),
243
244
  date: new Date().toJSON(),
244
245
  networkFeeAmount: fee,
245
- type: 'default',
246
246
  view: 'default',
247
247
  events: [
248
248
  {
@@ -253,7 +253,6 @@ class BSEthereum {
253
253
  fromUrl: addressUrl,
254
254
  to: receiverAddress,
255
255
  toUrl: this.explorerService.buildAddressUrl(receiverAddress),
256
- tokenType: isNativeToken ? 'native' : 'erc-20',
257
256
  tokenUrl: this.explorerService.buildContractUrl(tokenHash),
258
257
  token,
259
258
  },
@@ -272,7 +271,7 @@ class BSEthereum {
272
271
  return transactions;
273
272
  }
274
273
  async calculateTransferFee(params) {
275
- const signer = await this.generateSigner(params.senderAccount);
274
+ const signer = await this._generateSigner(params.senderAccount);
276
275
  let fee = ethers_1.ethers.utils.parseEther('0');
277
276
  for (const intent of params.intents) {
278
277
  const { gasPrice, transactionParams } = await this._buildTransferParams(intent);
@@ -1,5 +1,5 @@
1
1
  import type { TBSNetwork } from '@cityofzion/blockchain-service';
2
- import type { TBSEthereumNetworkId, TSupportedEVM } from '../types';
2
+ import type { TBSEthereumNetworkId, TBSEthereumName } from '../types';
3
3
  export declare class BSEthereumConstants {
4
4
  static readonly DEFAULT_DECIMALS = 18;
5
5
  static readonly DEFAULT_GAS_LIMIT = 21000;
@@ -7,5 +7,5 @@ export declare class BSEthereumConstants {
7
7
  static readonly NATIVE_SYMBOL_BY_NETWORK_ID: Record<TBSEthereumNetworkId, string>;
8
8
  static readonly NATIVE_WRAPPED_HASH_BY_NETWORK_ID: Partial<Record<TBSEthereumNetworkId, string>>;
9
9
  static readonly RPC_LIST_BY_NETWORK_ID: Record<TBSEthereumNetworkId, string[]>;
10
- static readonly NETWORKS_BY_EVM: Record<TSupportedEVM, TBSNetwork<TBSEthereumNetworkId>[]>;
10
+ static readonly NETWORKS_BY_EVM: Record<TBSEthereumName, TBSNetwork<TBSEthereumNetworkId>[]>;
11
11
  }
@@ -1,5 +1,5 @@
1
- import type { TBSNetwork, TBSNetworkId } from '@cityofzion/blockchain-service';
2
- import type { IBSEthereum, TBSEthereumNetworkId } from '../types';
1
+ import type { TBSNetwork } from '@cityofzion/blockchain-service';
2
+ import type { TBSEthereumNetworkId } from '../types';
3
3
  export declare class BSEthereumHelper {
4
4
  static getNativeAsset(network: TBSNetwork<TBSEthereumNetworkId>): {
5
5
  symbol: string;
@@ -7,5 +7,4 @@ export declare class BSEthereumHelper {
7
7
  decimals: number;
8
8
  hash: string;
9
9
  };
10
- static isMainnetNetwork<N extends string, A extends TBSNetworkId>(service: IBSEthereum<N, A>): boolean;
11
10
  }
@@ -5,10 +5,7 @@ const BSEthereumConstants_1 = require("../constants/BSEthereumConstants");
5
5
  class BSEthereumHelper {
6
6
  static getNativeAsset(network) {
7
7
  const symbol = BSEthereumConstants_1.BSEthereumConstants.NATIVE_SYMBOL_BY_NETWORK_ID[network.id] ?? 'ETH';
8
- return { symbol, name: symbol, decimals: 18, hash: '0x' };
9
- }
10
- static isMainnetNetwork(service) {
11
- return (service.network.type === 'mainnet' && service.availableNetworks.some(network => network.id === service.network.id));
8
+ return { symbol, name: symbol, decimals: 18, hash: '-' };
12
9
  }
13
10
  }
14
11
  exports.BSEthereumHelper = BSEthereumHelper;
@@ -11,7 +11,7 @@ export declare class MoralisBDSEthereum<N extends string, A extends TBSNetworkId
11
11
  constructor(service: IBSEthereum<N, A>);
12
12
  getBalance(address: string): Promise<TBalanceResponse[]>;
13
13
  getTokenInfo(hash: string): Promise<TBSToken>;
14
- getTransaction(hash: string): Promise<TTransactionDefault<N>>;
15
- getTransactionsByAddress(params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N, TTransactionDefault<N>>>;
14
+ getTransaction(hash: string): Promise<TTransactionDefault>;
15
+ getTransactionsByAddress(params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<TTransactionDefault>>;
16
16
  getContract(hash: string): Promise<TContractResponse>;
17
17
  }
@@ -115,7 +115,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
115
115
  fromUrl,
116
116
  to: data.to_address,
117
117
  toUrl,
118
- tokenType: 'native',
119
118
  tokenUrl: this._service.explorerService.buildContractUrl(nativeToken.hash),
120
119
  token: nativeToken,
121
120
  });
@@ -146,7 +145,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
146
145
  fromUrl,
147
146
  to,
148
147
  toUrl,
149
- tokenType: 'erc-20',
150
148
  tokenUrl: this._service.explorerService.buildContractUrl(token.hash),
151
149
  token,
152
150
  });
@@ -163,7 +161,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
163
161
  fromUrl,
164
162
  to,
165
163
  toUrl,
166
- tokenType: 'erc-721',
167
164
  nft,
168
165
  });
169
166
  });
@@ -177,7 +174,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
177
174
  networkFeeAmount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromNumber(data.transaction_fee), {
178
175
  decimals: this._service.feeToken.decimals,
179
176
  }),
180
- type: 'default',
181
177
  view: 'default',
182
178
  events,
183
179
  };
@@ -209,7 +205,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
209
205
  fromUrl,
210
206
  to: transfer.to_address,
211
207
  toUrl,
212
- tokenType: 'native',
213
208
  tokenUrl: this._service.explorerService.buildContractUrl(nativeAsset.hash),
214
209
  token: nativeAsset,
215
210
  });
@@ -236,7 +231,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
236
231
  fromUrl,
237
232
  to: transfer.to_address,
238
233
  toUrl,
239
- tokenType: 'erc-20',
240
234
  tokenUrl: this._service.explorerService.buildContractUrl(token.hash),
241
235
  token,
242
236
  });
@@ -254,7 +248,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
254
248
  fromUrl,
255
249
  to: transfer.to_address,
256
250
  toUrl,
257
- tokenType: 'erc-721',
258
251
  nft,
259
252
  });
260
253
  });
@@ -267,7 +260,6 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
267
260
  networkFeeAmount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromNumber(item.transaction_fee), {
268
261
  decimals: this._service.feeToken.decimals,
269
262
  }),
270
- type: 'default',
271
263
  view: 'default',
272
264
  events,
273
265
  });
@@ -1,13 +1,13 @@
1
1
  import { type TBalanceResponse, type IBlockchainDataService, type TBSNetworkId, type TBSToken, type TContractResponse, type TGetTransactionsByAddressParams, type TGetTransactionsByAddressResponse, type TTransactionDefault } from '@cityofzion/blockchain-service';
2
2
  import type { IBSEthereum } from '../../types';
3
- export declare class RpcBDSEthereum<N extends string, A extends TBSNetworkId, S extends IBSEthereum<N, A> = IBSEthereum<N, A>> implements IBlockchainDataService<N> {
3
+ export declare class RpcBDSEthereum<N extends string, A extends TBSNetworkId, S extends IBSEthereum<N, A> = IBSEthereum<N, A>> implements IBlockchainDataService {
4
4
  #private;
5
5
  readonly maxTimeToConfirmTransactionInMs: number;
6
6
  readonly _tokenCache: Map<string, TBSToken>;
7
7
  readonly _service: S;
8
8
  constructor(service: S);
9
- getTransaction(hash: string): Promise<TTransactionDefault<N>>;
10
- getTransactionsByAddress(_params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N, TTransactionDefault<N>>>;
9
+ getTransaction(hash: string): Promise<TTransactionDefault>;
10
+ getTransactionsByAddress(_params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<TTransactionDefault>>;
11
11
  getContract(_hash: string): Promise<TContractResponse>;
12
12
  getTokenInfo(hash: string): Promise<TBSToken>;
13
13
  getBalance(address: string): Promise<TBalanceResponse[]>;
@@ -46,7 +46,6 @@ class RpcBDSEthereum {
46
46
  networkFeeAmount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(fee.toString(), this._service.feeToken.decimals), {
47
47
  decimals: this._service.feeToken.decimals,
48
48
  }),
49
- type: 'default',
50
49
  view: 'default',
51
50
  events: [
52
51
  {
@@ -59,7 +58,6 @@ class RpcBDSEthereum {
59
58
  fromUrl,
60
59
  to: transaction.to,
61
60
  toUrl,
62
- tokenType: 'native',
63
61
  tokenUrl: this._service.explorerService.buildContractUrl(token.hash),
64
62
  token,
65
63
  },
@@ -26,7 +26,7 @@ class MoralisEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
26
26
  __classPrivateFieldSet(this, _MoralisEDSEthereum_service, service, "f");
27
27
  }
28
28
  async getTokenPrices({ tokens }) {
29
- if (!BSEthereumHelper_1.BSEthereumHelper.isMainnetNetwork(__classPrivateFieldGet(this, _MoralisEDSEthereum_service, "f")))
29
+ if (__classPrivateFieldGet(this, _MoralisEDSEthereum_service, "f").network.type !== 'mainnet')
30
30
  throw new Error('Exchange is only available on mainnet');
31
31
  if (!MoralisBDSEthereum_1.MoralisBDSEthereum.isSupported(__classPrivateFieldGet(this, _MoralisEDSEthereum_service, "f").network))
32
32
  throw new Error('Exchange is not supported on this network');
@@ -82,7 +82,7 @@ class MoralisEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
82
82
  return response;
83
83
  }
84
84
  async getTokenPriceHistory(params) {
85
- if (!BSEthereumHelper_1.BSEthereumHelper.isMainnetNetwork(__classPrivateFieldGet(this, _MoralisEDSEthereum_service, "f")))
85
+ if (__classPrivateFieldGet(this, _MoralisEDSEthereum_service, "f").network.type !== 'mainnet')
86
86
  throw new Error('Exchange is only available on mainnet');
87
87
  if (!MoralisBDSEthereum_1.MoralisBDSEthereum.isSupported(__classPrivateFieldGet(this, _MoralisEDSEthereum_service, "f").network))
88
88
  throw new Error('Exchange is not supported on this network');
@@ -1,12 +1,11 @@
1
1
  import { type IFullTransactionsDataService, type TBSNetworkId, type TExportFullTransactionsByAddressParams, type TGetFullTransactionsByAddressParams, type TGetTransactionsByAddressResponse, type TTransactionDefault } from '@cityofzion/blockchain-service';
2
2
  import type { IBSEthereum, TBSEthereumNetworkId } from '../../types';
3
- export declare class MoralisFullTransactionsDataServiceEthereum<N extends string, A extends TBSNetworkId> implements IFullTransactionsDataService<N> {
3
+ export declare class MoralisFullTransactionsDataServiceEthereum<N extends string, A extends TBSNetworkId> implements IFullTransactionsDataService {
4
4
  #private;
5
5
  static readonly SUPPORTED_NETWORKS_IDS: TBSEthereumNetworkId[];
6
6
  static readonly ERC721_STANDARDS: string[];
7
7
  static readonly ERC1155_STANDARDS: string[];
8
- static readonly ERC20_STANDARDS: string[];
9
8
  constructor(service: IBSEthereum<N, A>);
10
- getFullTransactionsByAddress({ nextPageParams, ...params }: TGetFullTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N, TTransactionDefault<N>>>;
9
+ getFullTransactionsByAddress({ nextPageParams, ...params }: TGetFullTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<TTransactionDefault>>;
11
10
  exportFullTransactionsByAddress(params: TExportFullTransactionsByAddressParams): Promise<string>;
12
11
  }
@@ -48,7 +48,6 @@ class MoralisFullTransactionsDataServiceEthereum {
48
48
  networkFeeAmount: networkFeeAmount
49
49
  ? blockchain_service_1.BSBigNumberHelper.format(networkFeeAmount, { decimals: nativeToken.decimals })
50
50
  : undefined,
51
- type: 'default',
52
51
  view: 'default',
53
52
  events: [],
54
53
  };
@@ -59,7 +58,6 @@ class MoralisFullTransactionsDataServiceEthereum {
59
58
  const standard = event.supportedStandards?.[0]?.toLowerCase() ?? '';
60
59
  const isErc1155 = MoralisFullTransactionsDataServiceEthereum.ERC1155_STANDARDS.includes(standard);
61
60
  const isErc721 = MoralisFullTransactionsDataServiceEthereum.ERC721_STANDARDS.includes(standard);
62
- const isErc20 = MoralisFullTransactionsDataServiceEthereum.ERC20_STANDARDS.includes(standard);
63
61
  const isNft = (isErc1155 || isErc721) && !!tokenHash;
64
62
  const fromUrl = from ? __classPrivateFieldGet(this, _MoralisFullTransactionsDataServiceEthereum_service, "f").explorerService.buildAddressUrl(from) : undefined;
65
63
  const toUrl = to ? __classPrivateFieldGet(this, _MoralisFullTransactionsDataServiceEthereum_service, "f").explorerService.buildAddressUrl(to) : undefined;
@@ -73,7 +71,6 @@ class MoralisFullTransactionsDataServiceEthereum {
73
71
  fromUrl,
74
72
  to,
75
73
  toUrl,
76
- tokenType: isErc1155 ? 'erc-1155' : 'erc-721',
77
74
  nft,
78
75
  });
79
76
  return;
@@ -89,7 +86,6 @@ class MoralisFullTransactionsDataServiceEthereum {
89
86
  fromUrl,
90
87
  to,
91
88
  toUrl,
92
- tokenType: isErc20 ? 'erc-20' : 'generic',
93
89
  tokenUrl: token ? __classPrivateFieldGet(this, _MoralisFullTransactionsDataServiceEthereum_service, "f").explorerService.buildContractUrl(token.hash) : undefined,
94
90
  token,
95
91
  });
@@ -119,4 +115,3 @@ _MoralisFullTransactionsDataServiceEthereum_service = new WeakMap();
119
115
  MoralisFullTransactionsDataServiceEthereum.SUPPORTED_NETWORKS_IDS = ['1', '42161', '8453', '137'];
120
116
  MoralisFullTransactionsDataServiceEthereum.ERC721_STANDARDS = ['erc721', 'erc-721'];
121
117
  MoralisFullTransactionsDataServiceEthereum.ERC1155_STANDARDS = ['erc1155', 'erc-1155'];
122
- MoralisFullTransactionsDataServiceEthereum.ERC20_STANDARDS = ['erc20', 'erc-20'];
@@ -1,4 +1,5 @@
1
1
  import { TokenService } from '@cityofzion/blockchain-service';
2
- export declare class TokenServiceEthereum extends TokenService {
2
+ import type { TBSEthereumNetworkId } from '../../types';
3
+ export declare class TokenServiceEthereum<N extends string, A extends TBSEthereumNetworkId> extends TokenService<N, A> {
3
4
  normalizeHash(hash: string): string;
4
5
  }
@@ -71,7 +71,7 @@ class WalletConnectServiceEthereum {
71
71
  else {
72
72
  param.gasPrice = param.gasPrice ?? gasPrice;
73
73
  }
74
- const wallet = await this._service.generateSigner(args.account);
74
+ const wallet = await this._service._generateSigner(args.account);
75
75
  const connectedWallet = wallet.connect(provider);
76
76
  if (!param.gasLimit) {
77
77
  try {
@@ -92,7 +92,7 @@ class WalletConnectServiceEthereum {
92
92
  return { wallet, provider, param };
93
93
  }
94
94
  async personal_sign(args) {
95
- const wallet = await this._service.generateSigner(args.account);
95
+ const wallet = await this._service._generateSigner(args.account);
96
96
  const message = args.params.filter((param) => !ethers_1.ethers.utils.isAddress(param))[0];
97
97
  const convertedMessage = __classPrivateFieldGet(this, _WalletConnectServiceEthereum_instances, "m", _WalletConnectServiceEthereum_convertHexToUtf8).call(this, message);
98
98
  return await wallet.signMessage(convertedMessage);
@@ -105,7 +105,7 @@ class WalletConnectServiceEthereum {
105
105
  return await wallet.signTransaction(param);
106
106
  }
107
107
  async eth_signTypedData(args) {
108
- const wallet = await this._service.generateSigner(args.account);
108
+ const wallet = await this._service._generateSigner(args.account);
109
109
  const data = args.params.filter((param) => !ethers_1.ethers.utils.isAddress(param))[0];
110
110
  const parsedData = typeof data === 'string' ? JSON.parse(data) : data;
111
111
  const { domain, types, message } = parsedData;
@@ -131,7 +131,7 @@ class WalletConnectServiceEthereum {
131
131
  return await connectedWallet.call(param);
132
132
  }
133
133
  async eth_requestAccounts(args) {
134
- const wallet = await this._service.generateSigner(args.account);
134
+ const wallet = await this._service._generateSigner(args.account);
135
135
  return [await wallet.getAddress()];
136
136
  }
137
137
  async eth_sendRawTransaction(args) {
package/dist/types.d.ts CHANGED
@@ -2,9 +2,9 @@ import type { IBlockchainService, IBSWithEncryption, IBSWithExplorer, IBSWithFee
2
2
  import { TypedDataSigner } from '@ethersproject/abstract-signer';
3
3
  import { ethers } from 'ethers';
4
4
  export type TBSEthereumNetworkId = TBSNetworkId<'1' | '10' | '25' | '56' | '137' | '250' | '1101' | '8453' | '80002' | '42161' | '42220' | '43114' | '59144' | '11155111'>;
5
- export type TSupportedEVM = 'ethereum' | 'polygon' | 'base' | 'arbitrum';
6
- export interface IBSEthereum<N extends string = string, A extends string = TBSEthereumNetworkId> extends IBlockchainService<N, A>, IBSWithNameService, IBSWithNft, IBSWithFee<N>, IBSWithLedger<N>, IBSWithExplorer, IBSWithEncryption<N>, IBSWithWalletConnect<N>, IBSWithFullTransactions<N> {
7
- generateSigner(account: TBSAccount<N>): Promise<ethers.Signer & TypedDataSigner>;
5
+ export type TBSEthereumName = 'ethereum' | 'polygon' | 'base' | 'arbitrum';
6
+ export interface IBSEthereum<N extends string = TBSEthereumName, A extends TBSNetworkId = TBSEthereumNetworkId> extends IBlockchainService<N, A>, IBSWithNameService, IBSWithNft, IBSWithFee<N>, IBSWithLedger<N>, IBSWithExplorer, IBSWithEncryption<N>, IBSWithWalletConnect<N>, IBSWithFullTransactions {
7
+ _generateSigner(account: TBSAccount<N>): Promise<ethers.Signer & TypedDataSigner>;
8
8
  }
9
9
  export type TMoralisBDSEthereumNativeBalanceApiResponse = {
10
10
  balance: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-ethereum",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "repository": "https://github.com/CityOfZion/blockchain-services",
5
5
  "license": "GPL-3.0-only",
6
6
  "author": "Coz",
@@ -19,7 +19,7 @@
19
19
  "@ledgerhq/hw-app-eth": "~7.3.0",
20
20
  "axios": "~1.13.5",
21
21
  "ethers": "5.8.0",
22
- "@cityofzion/blockchain-service": "3.1.3"
22
+ "@cityofzion/blockchain-service": "3.1.4"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@ledgerhq/hw-transport": "~6.32.0",
@@ -31,7 +31,7 @@
31
31
  "vitest": "~4.0.18"
32
32
  },
33
33
  "scripts": {
34
- "build": "rm -rf ./dist && npm run typecheck && tsc --project tsconfig.build.json",
34
+ "build": "rm -rf ./dist && rm -f *.tgz && npm run typecheck && tsc --project tsconfig.build.json",
35
35
  "format": "eslint --fix",
36
36
  "lint": "eslint .",
37
37
  "package": "npm run build && npm pack",