@riocrypto/common-server 1.0.605 → 1.0.607

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.
@@ -3,4 +3,5 @@ export declare class EtherscanClient {
3
3
  private axios;
4
4
  constructor(axios: AxiosStatic | AxiosInstance);
5
5
  getTransactions(address: string): Promise<any[]>;
6
+ getTokenTransactions(contractAddress: string, address: string): Promise<any[]>;
6
7
  }
@@ -25,5 +25,15 @@ class EtherscanClient {
25
25
  return data.result;
26
26
  });
27
27
  }
28
+ getTokenTransactions(contractAddress, address) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const ETHERSCAN_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("ETHERSCAN_API_KEY");
31
+ if (!ETHERSCAN_API_KEY) {
32
+ throw new Error("Unable to get ETHERSCAN_API_KEY");
33
+ }
34
+ const { data } = yield this.axios.get(`https://api.etherscan.io/api?module=account&action=tokentx&&contractaddress=${contractAddress}address=${address}&startblock=0&endblock=99999999&page=1&offset=100&sort=asc&apikey=${ETHERSCAN_API_KEY}`);
35
+ return data.result;
36
+ });
37
+ }
28
38
  }
29
39
  exports.EtherscanClient = EtherscanClient;
@@ -3,8 +3,7 @@ import { Crypto } from "@riocrypto/common";
3
3
  declare class FireblocksClient {
4
4
  fireblocks: FireblocksSDK;
5
5
  constructor(privateKey: string, apiKey: string);
6
- estimateWithdrawFromExchangeFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | undefined>;
7
- estimateWithdrawFromVaultFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | undefined>;
6
+ estimateWithdrawFromFee(crypto: Crypto): Promise<string | undefined>;
8
7
  withdrawFromExchange(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
9
8
  withdrawFromVault(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
10
9
  getVaultCryptoBalance(crypto: Crypto): Promise<number>;
@@ -16,43 +16,9 @@ class FireblocksClient {
16
16
  constructor(privateKey, apiKey) {
17
17
  this.fireblocks = new fireblocks_sdk_1.FireblocksSDK(privateKey, apiKey, "https://api.fireblocks.io");
18
18
  }
19
- estimateWithdrawFromExchangeFee(crypto, address, amountCrypto) {
19
+ estimateWithdrawFromFee(crypto) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
- let estimate = yield this.fireblocks.estimateFeeForTransaction({
22
- assetId: crypto,
23
- source: {
24
- type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
25
- id: "2",
26
- },
27
- destination: {
28
- type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
29
- oneTimeAddress: {
30
- address,
31
- },
32
- },
33
- amount: amountCrypto,
34
- operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
35
- });
36
- return estimate.medium.networkFee;
37
- });
38
- }
39
- estimateWithdrawFromVaultFee(crypto, address, amountCrypto) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- let estimate = yield this.fireblocks.estimateFeeForTransaction({
42
- assetId: crypto,
43
- source: {
44
- type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
45
- id: "2",
46
- },
47
- destination: {
48
- type: fireblocks_sdk_1.PeerType.ONE_TIME_ADDRESS,
49
- oneTimeAddress: {
50
- address,
51
- },
52
- },
53
- amount: amountCrypto,
54
- operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
55
- });
21
+ let estimate = yield this.fireblocks.getFeeForAsset(crypto);
56
22
  return estimate.medium.networkFee;
57
23
  });
58
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.605",
3
+ "version": "1.0.607",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@aws-sdk/client-s3": "^3.297.0",
25
25
  "@google-cloud/storage": "^6.9.5",
26
- "@riocrypto/common": "^1.0.579",
26
+ "@riocrypto/common": "^1.0.581",
27
27
  "@types/express": "^4.17.13",
28
28
  "axios": "^0.27.2",
29
29
  "ccxt": "^3.0.30",