@bronlabs/intents-sdk 1.0.116 → 1.0.117
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.
|
@@ -11,4 +11,6 @@ export declare class CosmosNetwork implements Network {
|
|
|
11
11
|
getDecimals(tokenAddress: string): Promise<number>;
|
|
12
12
|
getTxData(txHash: string, tokenAddress: string): Promise<TransactionData | undefined>;
|
|
13
13
|
transfer(privateKey: string, to: string, value: bigint, tokenAddress: string): Promise<string>;
|
|
14
|
+
private parseEventAttributes;
|
|
15
|
+
private rpcCall;
|
|
14
16
|
}
|
package/dist/networks/cosmos.js
CHANGED
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
import { log } from '../utils.js';
|
|
2
2
|
import { proxyFetch } from '../proxy.js';
|
|
3
|
-
import {
|
|
4
|
-
import { GasPrice, SigningStargateClient
|
|
3
|
+
import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing';
|
|
4
|
+
import { GasPrice, SigningStargateClient } from '@cosmjs/stargate';
|
|
5
5
|
import { Tendermint37Client } from '@cosmjs/tendermint-rpc';
|
|
6
|
-
import { MsgSend } from 'cosmjs-types/cosmos/bank/v1beta1/tx';
|
|
7
|
-
class ProxyRpcClient {
|
|
8
|
-
constructor(url) {
|
|
9
|
-
this.url = url;
|
|
10
|
-
}
|
|
11
|
-
disconnect() { }
|
|
12
|
-
async execute(request) {
|
|
13
|
-
const response = await proxyFetch(this.url, {
|
|
14
|
-
method: 'POST',
|
|
15
|
-
headers: { 'Content-Type': 'application/json' },
|
|
16
|
-
body: JSON.stringify(request),
|
|
17
|
-
});
|
|
18
|
-
if (!response.ok) {
|
|
19
|
-
const body = await response.text().catch(() => '');
|
|
20
|
-
throw new Error(`Cosmos RPC request to ${this.url} failed: ${response.status} ${response.statusText} - ${body}`);
|
|
21
|
-
}
|
|
22
|
-
const json = await response.json();
|
|
23
|
-
if (json.error) {
|
|
24
|
-
throw new Error(JSON.stringify(json.error));
|
|
25
|
-
}
|
|
26
|
-
return json;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function createCometClient(rpcUrl) {
|
|
30
|
-
return Tendermint37Client.create(new ProxyRpcClient(rpcUrl));
|
|
31
|
-
}
|
|
32
6
|
export class CosmosNetwork {
|
|
33
7
|
constructor(rpcUrl, nativeDenom, bech32, gasPrice, confirmations = 1) {
|
|
34
8
|
this.retryDelay = 15000;
|
|
@@ -39,13 +13,7 @@ export class CosmosNetwork {
|
|
|
39
13
|
this.bech32 = bech32;
|
|
40
14
|
}
|
|
41
15
|
async ping() {
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
await client.getHeight();
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
client.disconnect();
|
|
48
|
-
}
|
|
16
|
+
await this.rpcCall('status');
|
|
49
17
|
}
|
|
50
18
|
async getDecimals(tokenAddress) {
|
|
51
19
|
let denom = tokenAddress;
|
|
@@ -54,27 +22,24 @@ export class CosmosNetwork {
|
|
|
54
22
|
}
|
|
55
23
|
const firstLetter = denom[0];
|
|
56
24
|
if (firstLetter === 'u') {
|
|
57
|
-
// micro
|
|
58
25
|
return 6;
|
|
59
26
|
}
|
|
60
27
|
if (firstLetter === 'a') {
|
|
61
|
-
// atto
|
|
62
28
|
return 18;
|
|
63
29
|
}
|
|
64
30
|
if (firstLetter === 'n') {
|
|
65
|
-
// nano
|
|
66
31
|
return 9;
|
|
67
32
|
}
|
|
68
33
|
return 0;
|
|
69
34
|
}
|
|
70
35
|
async getTxData(txHash, tokenAddress) {
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
36
|
+
const hashBase64 = Buffer.from(txHash, 'hex').toString('base64');
|
|
37
|
+
const result = await this.rpcCall('tx', { hash: hashBase64, prove: false });
|
|
38
|
+
if (!result || !result.tx_result) {
|
|
74
39
|
return;
|
|
75
40
|
}
|
|
76
|
-
if (
|
|
77
|
-
log.warn(`Transaction ${txHash} failed on blockchain:
|
|
41
|
+
if (result.tx_result.code !== 0) {
|
|
42
|
+
log.warn(`Transaction ${txHash} failed on blockchain: code=${result.tx_result.code}`);
|
|
78
43
|
return {
|
|
79
44
|
from: "",
|
|
80
45
|
to: "",
|
|
@@ -83,10 +48,10 @@ export class CosmosNetwork {
|
|
|
83
48
|
confirmed: false
|
|
84
49
|
};
|
|
85
50
|
}
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
89
|
-
log.warn(`Transaction ${txHash} has no
|
|
51
|
+
const events = result.tx_result.events || [];
|
|
52
|
+
const transferEvent = events.find((e) => e.type === 'transfer');
|
|
53
|
+
if (!transferEvent) {
|
|
54
|
+
log.warn(`Transaction ${txHash} has no transfer event`);
|
|
90
55
|
return {
|
|
91
56
|
from: "",
|
|
92
57
|
to: "",
|
|
@@ -95,15 +60,15 @@ export class CosmosNetwork {
|
|
|
95
60
|
confirmed: false
|
|
96
61
|
};
|
|
97
62
|
}
|
|
98
|
-
const
|
|
63
|
+
const attrs = this.parseEventAttributes(transferEvent.attributes);
|
|
99
64
|
let denom = tokenAddress;
|
|
100
|
-
// Native token - specified denom
|
|
101
65
|
if (tokenAddress === "0x0") {
|
|
102
66
|
denom = this.nativeDenom;
|
|
103
67
|
}
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
68
|
+
const amountStr = attrs.amount || '';
|
|
69
|
+
const amountMatch = amountStr.match(new RegExp(`(\\d+)${denom}`));
|
|
70
|
+
if (!amountMatch) {
|
|
71
|
+
log.warn(`Transaction ${txHash} has no amount for denom ${denom}: ${amountStr}`);
|
|
107
72
|
return {
|
|
108
73
|
from: "",
|
|
109
74
|
to: "",
|
|
@@ -112,33 +77,81 @@ export class CosmosNetwork {
|
|
|
112
77
|
confirmed: false
|
|
113
78
|
};
|
|
114
79
|
}
|
|
115
|
-
const
|
|
116
|
-
const currentBlock =
|
|
117
|
-
const txBlock =
|
|
80
|
+
const blockResult = await this.rpcCall('block');
|
|
81
|
+
const currentBlock = parseInt(blockResult.block.header.height);
|
|
82
|
+
const txBlock = parseInt(result.height);
|
|
118
83
|
const confirmed = (currentBlock - txBlock) >= this.confirmations;
|
|
119
84
|
log.info(`Confirmations ${txHash}: ${currentBlock}, confirmed: ${confirmed}`);
|
|
120
85
|
return {
|
|
121
|
-
from:
|
|
122
|
-
to:
|
|
86
|
+
from: attrs.sender || '',
|
|
87
|
+
to: attrs.recipient || '',
|
|
123
88
|
token: tokenAddress,
|
|
124
|
-
amount: BigInt(
|
|
125
|
-
confirmed
|
|
89
|
+
amount: BigInt(amountMatch[1]),
|
|
90
|
+
confirmed
|
|
126
91
|
};
|
|
127
92
|
}
|
|
128
93
|
async transfer(privateKey, to, value, tokenAddress) {
|
|
129
|
-
// 1) Create wallet/signer
|
|
130
94
|
const wallet = await DirectSecp256k1Wallet.fromKey(Buffer.from(privateKey, 'hex'), this.bech32);
|
|
131
95
|
const [account] = await wallet.getAccounts();
|
|
132
96
|
const sender = account.address;
|
|
133
|
-
|
|
97
|
+
const cometClient = await Tendermint37Client.create({
|
|
98
|
+
execute: async (request) => {
|
|
99
|
+
const response = await proxyFetch(this.rpcUrl, {
|
|
100
|
+
method: 'POST',
|
|
101
|
+
headers: { 'Content-Type': 'application/json' },
|
|
102
|
+
body: JSON.stringify(request),
|
|
103
|
+
});
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
throw new Error(`Cosmos RPC error: ${response.status}`);
|
|
106
|
+
}
|
|
107
|
+
const json = await response.json();
|
|
108
|
+
if (json.error) {
|
|
109
|
+
throw new Error(JSON.stringify(json.error));
|
|
110
|
+
}
|
|
111
|
+
return json;
|
|
112
|
+
},
|
|
113
|
+
disconnect: () => { }
|
|
114
|
+
});
|
|
134
115
|
const gasPrice = GasPrice.fromString(`${this.gasPrice}${this.nativeDenom}`);
|
|
135
|
-
const client = SigningStargateClient.createWithSigner(
|
|
116
|
+
const client = await SigningStargateClient.createWithSigner(cometClient, wallet, { gasPrice });
|
|
136
117
|
const denom = tokenAddress === "0x0" ? this.nativeDenom : tokenAddress;
|
|
137
|
-
// 3) Build amount (in *base* denom)
|
|
138
118
|
const amount = [{ denom, amount: value.toString() }];
|
|
139
|
-
// CosmosJs simulates tx and do transfer
|
|
140
119
|
const resultAuto = await client.sendTokens(sender, to, amount, "auto");
|
|
141
120
|
return resultAuto.transactionHash;
|
|
142
121
|
}
|
|
122
|
+
parseEventAttributes(attributes) {
|
|
123
|
+
const result = {};
|
|
124
|
+
for (const attr of attributes) {
|
|
125
|
+
try {
|
|
126
|
+
const key = Buffer.from(attr.key, 'base64').toString('utf-8');
|
|
127
|
+
const value = attr.value ? Buffer.from(attr.value, 'base64').toString('utf-8') : '';
|
|
128
|
+
result[key] = value;
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
result[attr.key] = attr.value || '';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
async rpcCall(method, params = {}) {
|
|
137
|
+
const resp = await proxyFetch(this.rpcUrl, {
|
|
138
|
+
method: 'POST',
|
|
139
|
+
headers: { 'Content-Type': 'application/json' },
|
|
140
|
+
body: JSON.stringify({
|
|
141
|
+
jsonrpc: '2.0',
|
|
142
|
+
id: 1,
|
|
143
|
+
method,
|
|
144
|
+
params
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
if (!resp.ok) {
|
|
148
|
+
throw new Error(`Cosmos RPC error ${resp.status}: ${(await resp.text()).substring(0, 1024)}`);
|
|
149
|
+
}
|
|
150
|
+
const json = await resp.json();
|
|
151
|
+
if (json.error) {
|
|
152
|
+
throw new Error(`Cosmos RPC error: ${JSON.stringify(json.error)}`);
|
|
153
|
+
}
|
|
154
|
+
return json.result;
|
|
155
|
+
}
|
|
143
156
|
}
|
|
144
157
|
//# sourceMappingURL=cosmos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../../src/networks/cosmos.ts"],"names":[],"mappings":"AACA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tC,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,SAA8B,EAAE;QACpE,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE;YACzC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,EAAE,EAAE,CAAC;gBACL,MAAM;gBACN,MAAM;aACP,CAAC;SACI,CAAC,CAAC;QAEV,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAChG,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAS,CAAC;QAEtC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
package/dist/networks/ton.js
CHANGED
package/dist/networks/xrp.js
CHANGED
|
@@ -155,7 +155,7 @@ export class XrpNetwork {
|
|
|
155
155
|
return signed.hash;
|
|
156
156
|
}
|
|
157
157
|
parseTokenAddress(tokenAddress) {
|
|
158
|
-
const colonIndex = tokenAddress.indexOf('
|
|
158
|
+
const colonIndex = tokenAddress.indexOf('.');
|
|
159
159
|
if (colonIndex === -1) {
|
|
160
160
|
throw new Error(`Invalid XRP token address format: ${tokenAddress}. Expected "currency:issuer"`);
|
|
161
161
|
}
|