@ercworldio/blockchain-shared 1.0.1-dev.9 → 1.0.2-dev-PROJ-1265.1
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/README.md +26 -0
- package/build/chains/networks_dev.json +116 -25
- package/build/chains/networks_prod-bu.json +116 -8
- package/build/chains/networks_prod-dz.json +216 -13
- package/build/chains/networks_stg-bu.json +36 -9
- package/build/chains/networks_stg-dz.json +82 -22
- package/build/chains/networks_stg-sh.json +534 -0
- package/build/chains/networks_stg-yb.json +435 -0
- package/build/chains/stg-sh.json +93 -0
- package/build/contracts/Escrow.d.ts +1 -1
- package/build/contracts/Escrow.d.ts.map +1 -1
- package/build/contracts/Escrow.js +2 -2
- package/build/contracts/artifacts/Escrow.json +16 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.d.ts +232 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.d.ts.map +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.js +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/index.d.ts +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/index.d.ts +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.d.ts +21 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.d.ts.map +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.js +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.d.ts +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.js +2 -0
- package/build/contracts/typechain-types/contracts/escrow/Escrow.d.ts +5 -3
- package/build/contracts/typechain-types/contracts/escrow/Escrow.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.d.ts +290 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.js +390 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/index.d.ts +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/index.js +3 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.d.ts +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.js +2 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.d.ts +47 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.js +71 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.d.ts +2 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.js +8 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.js +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.js +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts +13 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.js +17 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/TokensWhitelist__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/TokensWhitelist__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/TokensWhitelist__factory.js +1 -1
- package/build/contracts/typechain-types/index.d.ts +4 -0
- package/build/contracts/typechain-types/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/index.js +5 -1
- package/build/errors/AdminErrors.d.ts +5 -9
- package/build/errors/AdminErrors.d.ts.map +1 -1
- package/build/errors/AdminErrors.js +49 -24
- package/build/errors/AlchemyErrors.d.ts +14 -18
- package/build/errors/AlchemyErrors.d.ts.map +1 -1
- package/build/errors/AlchemyErrors.js +76 -49
- package/build/errors/BalanceErrors.d.ts +3 -7
- package/build/errors/BalanceErrors.d.ts.map +1 -1
- package/build/errors/BalanceErrors.js +47 -26
- package/build/errors/DatabaseErrors.d.ts +5 -9
- package/build/errors/DatabaseErrors.d.ts.map +1 -1
- package/build/errors/DatabaseErrors.js +49 -28
- package/build/errors/TransactionsErrors.d.ts +15 -20
- package/build/errors/TransactionsErrors.d.ts.map +1 -1
- package/build/errors/TransactionsErrors.js +81 -66
- package/build/errors/VoltageErrors.d.ts +8 -13
- package/build/errors/VoltageErrors.d.ts.map +1 -1
- package/build/errors/VoltageErrors.js +58 -45
- package/build/errors/WalletErrors.d.ts +6 -12
- package/build/errors/WalletErrors.d.ts.map +1 -1
- package/build/errors/WalletErrors.js +48 -37
- package/build/errors/errors.d.ts +169 -27
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +292 -66
- package/build/errors/index.d.ts +37 -36
- package/build/errors/index.d.ts.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -2
- package/build/interfaces.d.ts +5 -1
- package/build/interfaces.d.ts.map +1 -1
- package/build/interfaces.js +1 -0
- package/build/services/AlchemyWebhookAddressManager.d.ts.map +1 -1
- package/build/services/AlchemyWebhookAddressManager.js +3 -1
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts +1 -2
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts.map +1 -1
- package/build/services/quicknode-notifications/QnWebhookAddressManager.js +25 -42
- package/build/services/quicknode-notifications/SetupNotifications.d.ts +1 -0
- package/build/services/quicknode-notifications/SetupNotifications.d.ts.map +1 -1
- package/build/services/quicknode-notifications/SetupNotifications.js +29 -2
- package/build/services/solana/escrow/SolanaEscrowAdmin.d.ts +1 -1
- package/build/services/solana/escrow/SolanaEscrowAdmin.d.ts.map +1 -1
- package/build/services/solana/escrow/SolanaEscrowAdmin.js +8 -4
- package/build/services/solana/escrow/services/EscrowAdminUtility.d.ts.map +1 -1
- package/build/services/solana/escrow/services/EscrowAdminUtility.js +5 -2
- package/build/services/solana/escrow/services/SolanaTokenProgramCache.d.ts +9 -0
- package/build/services/solana/escrow/services/SolanaTokenProgramCache.d.ts.map +1 -0
- package/build/services/solana/escrow/services/SolanaTokenProgramCache.js +38 -0
- package/build/services/types/bo_withdrawal.d.ts +17 -0
- package/build/services/types/bo_withdrawal.d.ts.map +1 -0
- package/build/services/types/bo_withdrawal.js +9 -0
- package/build/services/types/chain_manager.d.ts +7 -0
- package/build/services/types/chain_manager.d.ts.map +1 -1
- package/build/services/types/index.d.ts +1 -0
- package/build/services/types/index.d.ts.map +1 -1
- package/build/services/types/index.js +1 -0
- package/build/utils/Logger.d.ts.map +1 -1
- package/build/utils/Logger.js +13 -2
- package/build/utils/RpcLimiter.d.ts +1 -0
- package/build/utils/RpcLimiter.d.ts.map +1 -1
- package/build/utils/RpcLimiter.js +1 -0
- package/build/utils/solana.d.ts +2 -1
- package/build/utils/solana.d.ts.map +1 -1
- package/build/utils/solana.js +28 -3
- package/package.json +1 -1
|
@@ -55,6 +55,7 @@ const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
|
55
55
|
const TransactionsService_1 = require("./TransactionsService");
|
|
56
56
|
const Errors_1 = __importDefault(require("./Errors"));
|
|
57
57
|
const TokenAccountService_1 = require("./TokenAccountService");
|
|
58
|
+
const SolanaTokenProgramCache_1 = require("./SolanaTokenProgramCache");
|
|
58
59
|
class EscrowAdminUtility {
|
|
59
60
|
constructor(program, provider) {
|
|
60
61
|
this.program = program;
|
|
@@ -135,8 +136,10 @@ class EscrowAdminUtility {
|
|
|
135
136
|
balances.set(token_pubkey.toBase58(), bal);
|
|
136
137
|
}
|
|
137
138
|
else {
|
|
138
|
-
|
|
139
|
-
const
|
|
139
|
+
// Get mint's token program id (2022 or standard)
|
|
140
|
+
const token_prog = yield SolanaTokenProgramCache_1.SolanaTokenProgramCache.getInstance().getTokenProgramId(this.provider.connection, new web3_js_1.PublicKey(token));
|
|
141
|
+
const ata = yield (0, spl_token_1.getAssociatedTokenAddress)(new web3_js_1.PublicKey(token), vault_authority, true, token_prog);
|
|
142
|
+
const bal = yield this.provider.connection.getTokenAccountBalance(ata);
|
|
140
143
|
balances.set(token_pubkey.toBase58(), Number(bal.value.amount));
|
|
141
144
|
}
|
|
142
145
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import web3, { PublicKey } from "@solana/web3.js";
|
|
2
|
+
export declare class SolanaTokenProgramCache {
|
|
3
|
+
private static instance;
|
|
4
|
+
private readonly cache;
|
|
5
|
+
private constructor();
|
|
6
|
+
static getInstance(): SolanaTokenProgramCache;
|
|
7
|
+
getTokenProgramId(connection: web3.Connection, mint: PublicKey): Promise<PublicKey>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=SolanaTokenProgramCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolanaTokenProgramCache.d.ts","sourceRoot":"","sources":["../../../../../src/services/solana/escrow/services/SolanaTokenProgramCache.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGlD,qBAAa,uBAAuB;IAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IAEtD,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,uBAAuB;IAOvC,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;CAS5F"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SolanaTokenProgramCache = void 0;
|
|
13
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
14
|
+
class SolanaTokenProgramCache {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.cache = new Map();
|
|
17
|
+
}
|
|
18
|
+
static getInstance() {
|
|
19
|
+
if (!SolanaTokenProgramCache.instance) {
|
|
20
|
+
SolanaTokenProgramCache.instance = new SolanaTokenProgramCache();
|
|
21
|
+
}
|
|
22
|
+
return SolanaTokenProgramCache.instance;
|
|
23
|
+
}
|
|
24
|
+
getTokenProgramId(connection, mint) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const key = mint.toBase58();
|
|
27
|
+
if (this.cache.has(key))
|
|
28
|
+
return this.cache.get(key);
|
|
29
|
+
const mintInfo = yield connection.getAccountInfo(mint);
|
|
30
|
+
if (!mintInfo)
|
|
31
|
+
throw new Error(`Mint ${mint.toBase58()} not found`);
|
|
32
|
+
const programId = mintInfo.owner.equals(spl_token_1.TOKEN_2022_PROGRAM_ID) ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID;
|
|
33
|
+
this.cache.set(key, programId);
|
|
34
|
+
return programId;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.SolanaTokenProgramCache = SolanaTokenProgramCache;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BlockchainType, NetworkConfig, PaymentToken } from "../../interfaces";
|
|
2
|
+
export interface ValidateWithdrawFundingPayload {
|
|
3
|
+
blockchain: BlockchainType;
|
|
4
|
+
chain_id: number;
|
|
5
|
+
receiver: string;
|
|
6
|
+
token: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
network: NetworkConfig;
|
|
9
|
+
payment_token: PaymentToken;
|
|
10
|
+
wallet_type: WalletType;
|
|
11
|
+
}
|
|
12
|
+
export declare enum WalletType {
|
|
13
|
+
FUNDING = "funding",
|
|
14
|
+
RENT_ENERGY = "rent-energy",
|
|
15
|
+
ESCROW = "escrow"
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=bo_withdrawal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bo_withdrawal.d.ts","sourceRoot":"","sources":["../../../src/services/types/bo_withdrawal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE/E,MAAM,WAAW,8BAA8B;IAC3C,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,YAAY,CAAC;IAC5B,WAAW,EAAE,UAAU,CAAC;CAC3B;AAGD,oBAAY,UAAU;IAClB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WalletType = void 0;
|
|
4
|
+
var WalletType;
|
|
5
|
+
(function (WalletType) {
|
|
6
|
+
WalletType["FUNDING"] = "funding";
|
|
7
|
+
WalletType["RENT_ENERGY"] = "rent-energy";
|
|
8
|
+
WalletType["ESCROW"] = "escrow";
|
|
9
|
+
})(WalletType || (exports.WalletType = WalletType = {}));
|
|
@@ -12,6 +12,10 @@ export type QuicknodeNotificationConfig = {
|
|
|
12
12
|
name: string;
|
|
13
13
|
network: string;
|
|
14
14
|
template: 'solanaWalletFilter' | 'evmWalletFilter';
|
|
15
|
+
/** 'wallet' (default) = custodial deposit addresses; 'contract' = escrow contract addresses */
|
|
16
|
+
source?: 'wallet' | 'contract';
|
|
17
|
+
/** Required when source === 'contract' — the chain ID to look up the escrow contract */
|
|
18
|
+
chain_id?: number;
|
|
15
19
|
};
|
|
16
20
|
export type QuicknodeStreamConfig = {
|
|
17
21
|
network: string;
|
|
@@ -46,9 +50,12 @@ export interface ChainAccountingDetails {
|
|
|
46
50
|
treasury_receiver: string;
|
|
47
51
|
overflow_treasury_receiver: string;
|
|
48
52
|
overflow_threshold_decimal: number;
|
|
53
|
+
min_funding_wallet_balance_usd: number;
|
|
54
|
+
allowed_receivers: string[];
|
|
49
55
|
}
|
|
50
56
|
export interface TronConfig {
|
|
51
57
|
trxTransferCost: number;
|
|
52
58
|
trc20TransferCost: number;
|
|
59
|
+
rentEnergyWallet: string;
|
|
53
60
|
}
|
|
54
61
|
//# sourceMappingURL=chain_manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain_manager.d.ts","sourceRoot":"","sources":["../../../src/services/types/chain_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC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AA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/utils/Logger.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAItD,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AASD,cAAM,MAAM;IACR,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAC,OAAO,CAA8B;IACpD,OAAO,CAAC,I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E,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM;IAcxE;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAI/C;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAI9C;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAM9C;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAO/C;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAM/C;;OAEG;IACH,OAAO,CAAC,aAAa;IAuCrB;;OAEG;IACH,OAAO,CAAC,cAAc;CAezB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,aAAa,MAAM,EAAE,UAAU,UAAU,KAAG,MAExF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/build/utils/Logger.js
CHANGED
|
@@ -84,8 +84,9 @@ class Logger {
|
|
|
84
84
|
* Warn level - sent to ElasticSearch
|
|
85
85
|
*/
|
|
86
86
|
warn(message, data) {
|
|
87
|
-
|
|
88
|
-
this.
|
|
87
|
+
const logData = this.normalizeData(data);
|
|
88
|
+
this.pino.warn(Object.assign({ source: this.source }, logData), message);
|
|
89
|
+
this.indexToElastic('Warning', message, logData);
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
91
92
|
* Error level - sent to ElasticSearch
|
|
@@ -129,6 +130,16 @@ class Logger {
|
|
|
129
130
|
stack: value.stack,
|
|
130
131
|
};
|
|
131
132
|
}
|
|
133
|
+
else if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
|
134
|
+
// Recurse one level to catch nested Error objects (e.g. { data: { err: Error } })
|
|
135
|
+
const nested = {};
|
|
136
|
+
for (const [nk, nv] of Object.entries(value)) {
|
|
137
|
+
nested[nk] = nv instanceof Error
|
|
138
|
+
? { name: nv.name, message: nv.message, stack: nv.stack }
|
|
139
|
+
: nv;
|
|
140
|
+
}
|
|
141
|
+
normalized[key] = nested;
|
|
142
|
+
}
|
|
132
143
|
else {
|
|
133
144
|
normalized[key] = value;
|
|
134
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcLimiter.d.ts","sourceRoot":"","sources":["../../src/utils/RpcLimiter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,gBAAgB,EAAE,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,qBAAa,UAAU;IACnB,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC;IAE5B,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO;IAIP,MAAM,CAAC,WAAW;IAQlB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB;CAWlD"}
|
|
1
|
+
{"version":3,"file":"RpcLimiter.d.ts","sourceRoot":"","sources":["../../src/utils/RpcLimiter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,gBAAgB,EAAE,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,qBAAa,UAAU;IACnB,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC;IAE5B,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO;IAIP,MAAM,CAAC,WAAW;IAQlB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB;CAWlD;AAED,eAAe,UAAU,CAAC"}
|
package/build/utils/solana.d.ts
CHANGED
|
@@ -70,7 +70,8 @@ export declare const handle_transfer_batch: (payloads: SolanaTransactionRequest[
|
|
|
70
70
|
success: SolanaTransactionSuccessRequest[];
|
|
71
71
|
failed: SolanaTransactionRequest[];
|
|
72
72
|
}>;
|
|
73
|
-
export declare const find_transfer_instruction: (tx: SolanaTransactionLog) => TransferInstructionRecord;
|
|
73
|
+
export declare const find_transfer_instruction: (tx: SolanaTransactionLog, receiver?: string) => TransferInstructionRecord;
|
|
74
|
+
export declare const find_transfer_instruction_depr: (tx: SolanaTransactionLog) => TransferInstructionRecord;
|
|
74
75
|
export declare const getSolanaConnection: (chainId: string, config: IConfig) => web3.Connection;
|
|
75
76
|
export declare const getSolanaArchivalConnection: (chainId: string, config: IConfig) => web3.Connection;
|
|
76
77
|
export declare const getSolanaConnectionPublic: (chainId: string) => web3.Connection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../src/utils/solana.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,OAAO,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,IAAI,EAAE,EAA6B,OAAO,EAAuC,SAAS,EAAgE,MAAM,iBAAiB,CAAA;AAGxL,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGnF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAG/C,eAAO,MAAM,2BAA2B,QAA2B,CAAC;AACpE,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACxC;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC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B,EAAE,EAAE,YAAY,IAAI,CAAC,UAAU,EAAE,YAAY,OAAO,YAAQ,EAAE,UAAU,OAAO,YAAQ,EAAE,QAAQ,aAAa,EAAE,QAAQ,OAAO;;;EAmJ1N,CAAA;AAsCD,eAAO,MAAM,0BAA0B,GAAU,UAAU,OAAO,EAAE,mBAAmB,wBAAwB,EAAE,EAAE,OAAO,OAAO,EAAE,QAAQ,aAAa,EAAE,QAAQ,OAAO,oBA2BxK,CAAA;AAED,MAAM,WAAW,yBAAyB;IACtC,UAAU,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACpB;AA2CD,eAAO,MAAM,uCAAuC,GAAU,mBAAmB,wBAAwB,EAAE,EAAE,YAAY,IAAI,CAAC,UAAU,EAAE,OAAO,OAAO,EAAE,YAAY,OAAO,EAAE,QAAQ,aAAa,EAAE,QAAQ,OAAO;;;;;;;EAoDpN,CAAA;AAuFD,eAAO,MAAM,sBAAsB,GAAU,UAAU,OAAO,EAAE,cAAc,MAAM,EAAE,cAAc,MAAM,EAAE,aAAa,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,aAAa,EAAE,QAAQ,OAAO,qBA6CrL,CAAA;AA0ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG"}
|
package/build/utils/solana.js
CHANGED
|
@@ -45,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.check_approve_delegate = exports.handle_create_versioned_transaction_spl = exports.estimate_withdraw_gas_cost = exports.create_versioned_transaction_solana = exports.get_token_account_info = exports.getSolanaConnectionPublic = exports.getSolanaArchivalConnection = exports.getSolanaConnection = exports.find_transfer_instruction = exports.handle_transfer_batch = exports.handle_sweep = exports.SplTransferCheckedLayout = exports.SolTransferInstructionLayout = exports.usdc_program_address = exports.solana_program_address = exports.min_solana_funding_lamports = void 0;
|
|
48
|
+
exports.check_approve_delegate = exports.handle_create_versioned_transaction_spl = exports.estimate_withdraw_gas_cost = exports.create_versioned_transaction_solana = exports.get_token_account_info = exports.getSolanaConnectionPublic = exports.getSolanaArchivalConnection = exports.getSolanaConnection = exports.find_transfer_instruction_depr = exports.find_transfer_instruction = exports.handle_transfer_batch = exports.handle_sweep = exports.SplTransferCheckedLayout = exports.SolTransferInstructionLayout = exports.usdc_program_address = exports.solana_program_address = exports.min_solana_funding_lamports = void 0;
|
|
49
49
|
const buffer_layout_utils_1 = require("@solana/buffer-layout-utils");
|
|
50
50
|
const buffer_layout_1 = require("@solana/buffer-layout");
|
|
51
51
|
const web3_js_1 = __importStar(require("@solana/web3.js"));
|
|
@@ -182,7 +182,32 @@ const handle_transfer_batch = (payloads_1, chain_id_1, token_type_1, connection_
|
|
|
182
182
|
return { status: true, signatures, success, failed };
|
|
183
183
|
});
|
|
184
184
|
exports.handle_transfer_batch = handle_transfer_batch;
|
|
185
|
-
const find_transfer_instruction = (tx) => {
|
|
185
|
+
const find_transfer_instruction = (tx, receiver) => {
|
|
186
|
+
const message = tx.transaction[0].message[0];
|
|
187
|
+
const target_instruction = message.instructions.find(i => {
|
|
188
|
+
const program = message.account_keys[parseInt(i.program_id_index)];
|
|
189
|
+
if (!token_program_addresses.some(a => a === program))
|
|
190
|
+
return false;
|
|
191
|
+
// If a receiver is specified and this is a native SOL transfer, match by
|
|
192
|
+
// the destination account (accounts[1]) to find the exact instruction for
|
|
193
|
+
// that recipient. Needed for batch sends where one tx has many transfers.
|
|
194
|
+
if (receiver && program === exports.solana_program_address) {
|
|
195
|
+
if (!i.accounts || i.accounts.length < 2)
|
|
196
|
+
return false;
|
|
197
|
+
return message.account_keys[i.accounts[1]] === receiver;
|
|
198
|
+
}
|
|
199
|
+
return true; // original behaviour: first matching program
|
|
200
|
+
});
|
|
201
|
+
if (!target_instruction)
|
|
202
|
+
throw new Error(`Cannot find program index for accepted payment tokens: ${token_program_addresses}`);
|
|
203
|
+
const program_index = target_instruction.program_id_index;
|
|
204
|
+
return {
|
|
205
|
+
instruction: target_instruction,
|
|
206
|
+
is_native: message.account_keys[parseInt(program_index)] === exports.solana_program_address
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
exports.find_transfer_instruction = find_transfer_instruction;
|
|
210
|
+
const find_transfer_instruction_depr = (tx) => {
|
|
186
211
|
const message = tx.transaction[0].message[0];
|
|
187
212
|
const target_instruction = message.instructions.find(i => token_program_addresses.some(a => a === message.account_keys[parseInt(i.program_id_index)]));
|
|
188
213
|
if (!target_instruction)
|
|
@@ -190,7 +215,7 @@ const find_transfer_instruction = (tx) => {
|
|
|
190
215
|
const program_index = target_instruction === null || target_instruction === void 0 ? void 0 : target_instruction.program_id_index;
|
|
191
216
|
return { instruction: target_instruction, is_native: tx.transaction[0].message[0].account_keys[parseInt(program_index)] === exports.solana_program_address };
|
|
192
217
|
};
|
|
193
|
-
exports.
|
|
218
|
+
exports.find_transfer_instruction_depr = find_transfer_instruction_depr;
|
|
194
219
|
const getSolanaConnection = (chainId, config) => {
|
|
195
220
|
const network = ChainManager_1.default.getInstance(config).getChainConfigForChainIdSync(parseInt(chainId));
|
|
196
221
|
if (!network)
|