@ercworldio/blockchain-shared 1.0.1-dev.14 → 1.0.1-dev.16
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/build/chains/networks_dev.json +35 -0
- 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 +16 -2
- package/build/services/types/chain_manager.d.ts +4 -0
- package/build/services/types/chain_manager.d.ts.map +1 -1
- 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
|
@@ -207,6 +207,13 @@
|
|
|
207
207
|
}
|
|
208
208
|
],
|
|
209
209
|
"quicknodeNotificationConfig": [
|
|
210
|
+
{
|
|
211
|
+
"name": "escrow-bnb-dev",
|
|
212
|
+
"network": "bnbchain-testnet",
|
|
213
|
+
"template": "evmWalletFilter",
|
|
214
|
+
"source": "contract",
|
|
215
|
+
"chain_id": 97
|
|
216
|
+
},
|
|
210
217
|
{
|
|
211
218
|
"name": "qn-custodial-webhook-bsc-dev",
|
|
212
219
|
"network": "bnbchain-testnet",
|
|
@@ -366,6 +373,13 @@
|
|
|
366
373
|
}
|
|
367
374
|
],
|
|
368
375
|
"quicknodeNotificationConfig": [
|
|
376
|
+
{
|
|
377
|
+
"name": "escrow-avax-dev",
|
|
378
|
+
"network": "avalanche-fuji",
|
|
379
|
+
"template": "evmWalletFilter",
|
|
380
|
+
"source": "contract",
|
|
381
|
+
"chain_id": 43113
|
|
382
|
+
},
|
|
369
383
|
{
|
|
370
384
|
"name": "qn-custodial-webhook-avax-dev",
|
|
371
385
|
"network": "avalanche-fuji",
|
|
@@ -467,6 +481,13 @@
|
|
|
467
481
|
}
|
|
468
482
|
],
|
|
469
483
|
"quicknodeNotificationConfig": [
|
|
484
|
+
{
|
|
485
|
+
"name": "escrow-eth-dev",
|
|
486
|
+
"network": "ethereum-sepolia",
|
|
487
|
+
"template": "evmWalletFilter",
|
|
488
|
+
"source": "contract",
|
|
489
|
+
"chain_id": 11155111
|
|
490
|
+
},
|
|
470
491
|
{
|
|
471
492
|
"name": "qn-custodial-webhook-eth-dev",
|
|
472
493
|
"network": "ethereum-sepolia",
|
|
@@ -554,6 +575,13 @@
|
|
|
554
575
|
}
|
|
555
576
|
],
|
|
556
577
|
"quicknodeNotificationConfig": [
|
|
578
|
+
{
|
|
579
|
+
"name": "escrow-pol-dev",
|
|
580
|
+
"network": "polygon-amoy",
|
|
581
|
+
"template": "evmWalletFilter",
|
|
582
|
+
"source": "contract",
|
|
583
|
+
"chain_id": 80002
|
|
584
|
+
},
|
|
557
585
|
{
|
|
558
586
|
"name": "qn-custodial-webhook-pol-dev",
|
|
559
587
|
"network": "polygon-amoy",
|
|
@@ -640,6 +668,13 @@
|
|
|
640
668
|
}
|
|
641
669
|
],
|
|
642
670
|
"quicknodeNotificationConfig": [
|
|
671
|
+
{
|
|
672
|
+
"name": "escrow-mon-dev",
|
|
673
|
+
"network": "monad-testnet",
|
|
674
|
+
"template": "evmWalletFilter",
|
|
675
|
+
"source": "contract",
|
|
676
|
+
"chain_id": 10143
|
|
677
|
+
},
|
|
643
678
|
{
|
|
644
679
|
"name": "qn-custodial-webhook-mon-dev",
|
|
645
680
|
"network": "monad-testnet",
|
|
@@ -27,6 +27,7 @@ declare class SetupNotifications extends BaseErrors {
|
|
|
27
27
|
* The `blockchain` filter value in DepositAddressService is the string stored
|
|
28
28
|
* in the DB — e.g. "solana", "evm", "ethereum", etc.
|
|
29
29
|
*/
|
|
30
|
+
private fetch_contract_addresses;
|
|
30
31
|
private fetch_all_db_addresses;
|
|
31
32
|
/**
|
|
32
33
|
* Register a newly-created webhook entry in the internal maps.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetupNotifications.d.ts","sourceRoot":"","sources":["../../../src/services/quicknode-notifications/SetupNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAiB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAQlE,MAAM,WAAW,wBAAwB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC;IAC3B,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC5B;AAWD,cAAM,kBAAmB,SAAQ,UAAU;IACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAC5C,OAAO,CAAC,GAAG,CAAqB;IAEhC,OAAO,CAAC,WAAW,CAAoD;IAEvE,OAAO,CAAC,aAAa,CAA8D;IAEnF,OAAO,CAAC,eAAe,CAAqD;IAC5E,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,EAAE,CAAgB;IAC1B,OAAO;IAOP,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,kBAAkB,GAAG,kBAAkB;IAO5F,mBAAmB,IAAI,MAAM,EAAE;IAI/B,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAOhF;;;;OAIG;YACW,sBAAsB;IAuBpC;;OAEG;IACH,OAAO,CAAC,cAAc;IAOT,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"SetupNotifications.d.ts","sourceRoot":"","sources":["../../../src/services/quicknode-notifications/SetupNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,cAAc,E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
|
@@ -53,6 +53,18 @@ class SetupNotifications extends errors_1.default {
|
|
|
53
53
|
* The `blockchain` filter value in DepositAddressService is the string stored
|
|
54
54
|
* in the DB — e.g. "solana", "evm", "ethereum", etc.
|
|
55
55
|
*/
|
|
56
|
+
fetch_contract_addresses(notif_config) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
var _a;
|
|
59
|
+
if (!notif_config.chain_id) {
|
|
60
|
+
console.warn(`SetupNotifications: source='contract' but no chain_id set for ${notif_config.name} — skipping`);
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
const chain_manager = ChainManager_1.default.getInstance(this.config);
|
|
64
|
+
const escrow_config = chain_manager.getEscrowContractForChain(notif_config.chain_id);
|
|
65
|
+
return (_a = escrow_config === null || escrow_config === void 0 ? void 0 : escrow_config.addresses) !== null && _a !== void 0 ? _a : [];
|
|
66
|
+
});
|
|
67
|
+
}
|
|
56
68
|
fetch_all_db_addresses(blockchain) {
|
|
57
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
70
|
const service = new DepositAddressService_1.default(this.db);
|
|
@@ -117,8 +129,10 @@ class SetupNotifications extends errors_1.default {
|
|
|
117
129
|
return ((_a = w.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === notif_config.name.toLowerCase() &&
|
|
118
130
|
((_b = w.network) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === notif_config.network.toLowerCase();
|
|
119
131
|
});
|
|
120
|
-
// Fetch
|
|
121
|
-
const db_addresses =
|
|
132
|
+
// Fetch addresses — contract source uses escrow addresses, wallet source uses DB deposit addresses
|
|
133
|
+
const db_addresses = notif_config.source === 'contract'
|
|
134
|
+
? yield this.fetch_contract_addresses(notif_config)
|
|
135
|
+
: yield this.fetch_all_db_addresses(notif_config.blockchain);
|
|
122
136
|
console.log(`SetupNotifications: ${db_addresses.length} DB addresses for blockchain=${notif_config.blockchain}`);
|
|
123
137
|
let webhook_id;
|
|
124
138
|
if (existing) {
|
|
@@ -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;
|
|
@@ -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;AAElD,MAAM,MAAM,6BAA6B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,QAAQ,CAAC;CACjC,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,oBAAoB,GAAG,iBAAiB,CAAC;
|
|
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;AAElD,MAAM,MAAM,6BAA6B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,C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M,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B,EAAE,MAAM,CAAC;IACnC,0BAA0B,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,UAAU;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC7B"}
|
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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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)
|