@allbridge/bridge-core-sdk 3.27.0-alpha.14 → 3.27.0-alpha.15
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/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +4 -4
- package/dist/src/chains/models.d.ts +2 -2
- package/dist/src/chains/models.js.map +1 -1
- package/dist/src/client/core-api/api-client.js +1 -0
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.js +29 -0
- package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
- package/dist/src/client/core-api/core-api.model.d.ts +13 -2
- package/dist/src/client/core-api/core-api.model.js.map +1 -1
- package/dist/src/models/index.d.ts +12 -4
- package/dist/src/models/index.js +4 -0
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/bridge/alg/index.js +52 -43
- package/dist/src/services/bridge/alg/index.js.map +1 -1
- package/dist/src/services/bridge/evm/index.d.ts +1 -0
- package/dist/src/services/bridge/evm/index.js +108 -33
- package/dist/src/services/bridge/evm/index.js.map +1 -1
- package/dist/src/services/bridge/index.d.ts +2 -2
- package/dist/src/services/bridge/index.js +10 -4
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.model.d.ts +9 -2
- package/dist/src/services/bridge/models/bridge.model.js.map +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js.map +1 -1
- package/dist/src/services/bridge/srb/index.js +36 -28
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/stx/index.js +23 -14
- package/dist/src/services/bridge/stx/index.js.map +1 -1
- package/dist/src/services/bridge/sui/index.js +166 -138
- package/dist/src/services/bridge/sui/index.js.map +1 -1
- package/dist/src/services/bridge/trx/index.js +98 -70
- package/dist/src/services/bridge/trx/index.js.map +1 -1
- package/dist/src/services/bridge/utils.js +63 -8
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/models/abi/PayerWithAbr.d.ts +203 -0
- package/dist/src/services/models/abi/PayerWithAbr.js +266 -0
- package/dist/src/services/models/abi/PayerWithAbr.js.map +1 -0
- package/dist/src/services/token/models/token.model.d.ts +4 -4
- package/dist/src/services/token/models/token.model.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +17 -0
- package/dist/src/tokens-info/tokens-info.model.js.map +1 -1
- package/dist/src/utils/utils.d.ts +1 -0
- package/dist/src/utils/utils.js +5 -0
- package/dist/src/utils/utils.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
declare const artifact: {
|
|
2
|
+
readonly abi: readonly [{
|
|
3
|
+
readonly inputs: readonly [{
|
|
4
|
+
readonly internalType: "address";
|
|
5
|
+
readonly name: "_abrTokenAddress";
|
|
6
|
+
readonly type: "address";
|
|
7
|
+
}, {
|
|
8
|
+
readonly internalType: "uint256";
|
|
9
|
+
readonly name: "_chainPrecision";
|
|
10
|
+
readonly type: "uint256";
|
|
11
|
+
}];
|
|
12
|
+
readonly stateMutability: "nonpayable";
|
|
13
|
+
readonly type: "constructor";
|
|
14
|
+
}, {
|
|
15
|
+
readonly anonymous: false;
|
|
16
|
+
readonly inputs: readonly [{
|
|
17
|
+
readonly indexed: true;
|
|
18
|
+
readonly internalType: "address";
|
|
19
|
+
readonly name: "previousOwner";
|
|
20
|
+
readonly type: "address";
|
|
21
|
+
}, {
|
|
22
|
+
readonly indexed: true;
|
|
23
|
+
readonly internalType: "address";
|
|
24
|
+
readonly name: "newOwner";
|
|
25
|
+
readonly type: "address";
|
|
26
|
+
}];
|
|
27
|
+
readonly name: "OwnershipTransferred";
|
|
28
|
+
readonly type: "event";
|
|
29
|
+
}, {
|
|
30
|
+
readonly stateMutability: "payable";
|
|
31
|
+
readonly type: "fallback";
|
|
32
|
+
}, {
|
|
33
|
+
readonly inputs: readonly [];
|
|
34
|
+
readonly name: "abrToken";
|
|
35
|
+
readonly outputs: readonly [{
|
|
36
|
+
readonly internalType: "contract IERC20Metadata";
|
|
37
|
+
readonly name: "";
|
|
38
|
+
readonly type: "address";
|
|
39
|
+
}];
|
|
40
|
+
readonly stateMutability: "view";
|
|
41
|
+
readonly type: "function";
|
|
42
|
+
}, {
|
|
43
|
+
readonly inputs: readonly [{
|
|
44
|
+
readonly internalType: "address";
|
|
45
|
+
readonly name: "_tokenAddress";
|
|
46
|
+
readonly type: "address";
|
|
47
|
+
}, {
|
|
48
|
+
readonly internalType: "address";
|
|
49
|
+
readonly name: "_bridge";
|
|
50
|
+
readonly type: "address";
|
|
51
|
+
}];
|
|
52
|
+
readonly name: "approveBridgeToken";
|
|
53
|
+
readonly outputs: readonly [];
|
|
54
|
+
readonly stateMutability: "nonpayable";
|
|
55
|
+
readonly type: "function";
|
|
56
|
+
}, {
|
|
57
|
+
readonly inputs: readonly [];
|
|
58
|
+
readonly name: "exchangeRate";
|
|
59
|
+
readonly outputs: readonly [{
|
|
60
|
+
readonly internalType: "uint256";
|
|
61
|
+
readonly name: "";
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
}];
|
|
64
|
+
readonly stateMutability: "view";
|
|
65
|
+
readonly type: "function";
|
|
66
|
+
}, {
|
|
67
|
+
readonly inputs: readonly [{
|
|
68
|
+
readonly internalType: "uint256";
|
|
69
|
+
readonly name: "_amount";
|
|
70
|
+
readonly type: "uint256";
|
|
71
|
+
}];
|
|
72
|
+
readonly name: "nativeTokensToAbr";
|
|
73
|
+
readonly outputs: readonly [{
|
|
74
|
+
readonly internalType: "uint256";
|
|
75
|
+
readonly name: "";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}];
|
|
78
|
+
readonly stateMutability: "view";
|
|
79
|
+
readonly type: "function";
|
|
80
|
+
}, {
|
|
81
|
+
readonly inputs: readonly [];
|
|
82
|
+
readonly name: "owner";
|
|
83
|
+
readonly outputs: readonly [{
|
|
84
|
+
readonly internalType: "address";
|
|
85
|
+
readonly name: "";
|
|
86
|
+
readonly type: "address";
|
|
87
|
+
}];
|
|
88
|
+
readonly stateMutability: "view";
|
|
89
|
+
readonly type: "function";
|
|
90
|
+
}, {
|
|
91
|
+
readonly inputs: readonly [{
|
|
92
|
+
readonly internalType: "uint256";
|
|
93
|
+
readonly name: "_id";
|
|
94
|
+
readonly type: "uint256";
|
|
95
|
+
}, {
|
|
96
|
+
readonly internalType: "address";
|
|
97
|
+
readonly name: "_target";
|
|
98
|
+
readonly type: "address";
|
|
99
|
+
}, {
|
|
100
|
+
readonly internalType: "string";
|
|
101
|
+
readonly name: "_signature";
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
}];
|
|
104
|
+
readonly name: "registerTarget";
|
|
105
|
+
readonly outputs: readonly [];
|
|
106
|
+
readonly stateMutability: "nonpayable";
|
|
107
|
+
readonly type: "function";
|
|
108
|
+
}, {
|
|
109
|
+
readonly inputs: readonly [];
|
|
110
|
+
readonly name: "renounceOwnership";
|
|
111
|
+
readonly outputs: readonly [];
|
|
112
|
+
readonly stateMutability: "nonpayable";
|
|
113
|
+
readonly type: "function";
|
|
114
|
+
}, {
|
|
115
|
+
readonly inputs: readonly [{
|
|
116
|
+
readonly internalType: "uint256";
|
|
117
|
+
readonly name: "_newExchangeRate";
|
|
118
|
+
readonly type: "uint256";
|
|
119
|
+
}];
|
|
120
|
+
readonly name: "setExchangeRate";
|
|
121
|
+
readonly outputs: readonly [];
|
|
122
|
+
readonly stateMutability: "nonpayable";
|
|
123
|
+
readonly type: "function";
|
|
124
|
+
}, {
|
|
125
|
+
readonly inputs: readonly [{
|
|
126
|
+
readonly internalType: "uint256";
|
|
127
|
+
readonly name: "id";
|
|
128
|
+
readonly type: "uint256";
|
|
129
|
+
}];
|
|
130
|
+
readonly name: "targets";
|
|
131
|
+
readonly outputs: readonly [{
|
|
132
|
+
readonly internalType: "address";
|
|
133
|
+
readonly name: "target";
|
|
134
|
+
readonly type: "address";
|
|
135
|
+
}, {
|
|
136
|
+
readonly internalType: "bytes4";
|
|
137
|
+
readonly name: "selector";
|
|
138
|
+
readonly type: "bytes4";
|
|
139
|
+
}];
|
|
140
|
+
readonly stateMutability: "view";
|
|
141
|
+
readonly type: "function";
|
|
142
|
+
}, {
|
|
143
|
+
readonly inputs: readonly [{
|
|
144
|
+
readonly internalType: "address";
|
|
145
|
+
readonly name: "newOwner";
|
|
146
|
+
readonly type: "address";
|
|
147
|
+
}];
|
|
148
|
+
readonly name: "transferOwnership";
|
|
149
|
+
readonly outputs: readonly [];
|
|
150
|
+
readonly stateMutability: "nonpayable";
|
|
151
|
+
readonly type: "function";
|
|
152
|
+
}, {
|
|
153
|
+
readonly inputs: readonly [{
|
|
154
|
+
readonly internalType: "address";
|
|
155
|
+
readonly name: "_token";
|
|
156
|
+
readonly type: "address";
|
|
157
|
+
}, {
|
|
158
|
+
readonly internalType: "uint256";
|
|
159
|
+
readonly name: "_amount";
|
|
160
|
+
readonly type: "uint256";
|
|
161
|
+
}, {
|
|
162
|
+
readonly internalType: "uint256";
|
|
163
|
+
readonly name: "_abrAmount";
|
|
164
|
+
readonly type: "uint256";
|
|
165
|
+
}, {
|
|
166
|
+
readonly internalType: "uint256";
|
|
167
|
+
readonly name: "_targetId";
|
|
168
|
+
readonly type: "uint256";
|
|
169
|
+
}, {
|
|
170
|
+
readonly internalType: "bytes";
|
|
171
|
+
readonly name: "_params";
|
|
172
|
+
readonly type: "bytes";
|
|
173
|
+
}];
|
|
174
|
+
readonly name: "transferTokensAndCallTarget";
|
|
175
|
+
readonly outputs: readonly [];
|
|
176
|
+
readonly stateMutability: "payable";
|
|
177
|
+
readonly type: "function";
|
|
178
|
+
}, {
|
|
179
|
+
readonly inputs: readonly [{
|
|
180
|
+
readonly internalType: "uint256";
|
|
181
|
+
readonly name: "amount";
|
|
182
|
+
readonly type: "uint256";
|
|
183
|
+
}];
|
|
184
|
+
readonly name: "withdrawGas";
|
|
185
|
+
readonly outputs: readonly [];
|
|
186
|
+
readonly stateMutability: "nonpayable";
|
|
187
|
+
readonly type: "function";
|
|
188
|
+
}, {
|
|
189
|
+
readonly inputs: readonly [{
|
|
190
|
+
readonly internalType: "address";
|
|
191
|
+
readonly name: "tokenAddress";
|
|
192
|
+
readonly type: "address";
|
|
193
|
+
}];
|
|
194
|
+
readonly name: "withdrawTokens";
|
|
195
|
+
readonly outputs: readonly [];
|
|
196
|
+
readonly stateMutability: "nonpayable";
|
|
197
|
+
readonly type: "function";
|
|
198
|
+
}, {
|
|
199
|
+
readonly stateMutability: "payable";
|
|
200
|
+
readonly type: "receive";
|
|
201
|
+
}];
|
|
202
|
+
};
|
|
203
|
+
export default artifact;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const artifact = {
|
|
4
|
+
abi: [
|
|
5
|
+
{
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
internalType: "address",
|
|
9
|
+
name: "_abrTokenAddress",
|
|
10
|
+
type: "address",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
internalType: "uint256",
|
|
14
|
+
name: "_chainPrecision",
|
|
15
|
+
type: "uint256",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
stateMutability: "nonpayable",
|
|
19
|
+
type: "constructor",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
anonymous: false,
|
|
23
|
+
inputs: [
|
|
24
|
+
{
|
|
25
|
+
indexed: true,
|
|
26
|
+
internalType: "address",
|
|
27
|
+
name: "previousOwner",
|
|
28
|
+
type: "address",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
indexed: true,
|
|
32
|
+
internalType: "address",
|
|
33
|
+
name: "newOwner",
|
|
34
|
+
type: "address",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
name: "OwnershipTransferred",
|
|
38
|
+
type: "event",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
stateMutability: "payable",
|
|
42
|
+
type: "fallback",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
inputs: [],
|
|
46
|
+
name: "abrToken",
|
|
47
|
+
outputs: [
|
|
48
|
+
{
|
|
49
|
+
internalType: "contract IERC20Metadata",
|
|
50
|
+
name: "",
|
|
51
|
+
type: "address",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
stateMutability: "view",
|
|
55
|
+
type: "function",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
inputs: [
|
|
59
|
+
{
|
|
60
|
+
internalType: "address",
|
|
61
|
+
name: "_tokenAddress",
|
|
62
|
+
type: "address",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
internalType: "address",
|
|
66
|
+
name: "_bridge",
|
|
67
|
+
type: "address",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
name: "approveBridgeToken",
|
|
71
|
+
outputs: [],
|
|
72
|
+
stateMutability: "nonpayable",
|
|
73
|
+
type: "function",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
inputs: [],
|
|
77
|
+
name: "exchangeRate",
|
|
78
|
+
outputs: [
|
|
79
|
+
{
|
|
80
|
+
internalType: "uint256",
|
|
81
|
+
name: "",
|
|
82
|
+
type: "uint256",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
stateMutability: "view",
|
|
86
|
+
type: "function",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
inputs: [
|
|
90
|
+
{
|
|
91
|
+
internalType: "uint256",
|
|
92
|
+
name: "_amount",
|
|
93
|
+
type: "uint256",
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
name: "nativeTokensToAbr",
|
|
97
|
+
outputs: [
|
|
98
|
+
{
|
|
99
|
+
internalType: "uint256",
|
|
100
|
+
name: "",
|
|
101
|
+
type: "uint256",
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
stateMutability: "view",
|
|
105
|
+
type: "function",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
inputs: [],
|
|
109
|
+
name: "owner",
|
|
110
|
+
outputs: [
|
|
111
|
+
{
|
|
112
|
+
internalType: "address",
|
|
113
|
+
name: "",
|
|
114
|
+
type: "address",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
stateMutability: "view",
|
|
118
|
+
type: "function",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
inputs: [
|
|
122
|
+
{
|
|
123
|
+
internalType: "uint256",
|
|
124
|
+
name: "_id",
|
|
125
|
+
type: "uint256",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
internalType: "address",
|
|
129
|
+
name: "_target",
|
|
130
|
+
type: "address",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
internalType: "string",
|
|
134
|
+
name: "_signature",
|
|
135
|
+
type: "string",
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
name: "registerTarget",
|
|
139
|
+
outputs: [],
|
|
140
|
+
stateMutability: "nonpayable",
|
|
141
|
+
type: "function",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
inputs: [],
|
|
145
|
+
name: "renounceOwnership",
|
|
146
|
+
outputs: [],
|
|
147
|
+
stateMutability: "nonpayable",
|
|
148
|
+
type: "function",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
inputs: [
|
|
152
|
+
{
|
|
153
|
+
internalType: "uint256",
|
|
154
|
+
name: "_newExchangeRate",
|
|
155
|
+
type: "uint256",
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
name: "setExchangeRate",
|
|
159
|
+
outputs: [],
|
|
160
|
+
stateMutability: "nonpayable",
|
|
161
|
+
type: "function",
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
inputs: [
|
|
165
|
+
{
|
|
166
|
+
internalType: "uint256",
|
|
167
|
+
name: "id",
|
|
168
|
+
type: "uint256",
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
name: "targets",
|
|
172
|
+
outputs: [
|
|
173
|
+
{
|
|
174
|
+
internalType: "address",
|
|
175
|
+
name: "target",
|
|
176
|
+
type: "address",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
internalType: "bytes4",
|
|
180
|
+
name: "selector",
|
|
181
|
+
type: "bytes4",
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
stateMutability: "view",
|
|
185
|
+
type: "function",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
inputs: [
|
|
189
|
+
{
|
|
190
|
+
internalType: "address",
|
|
191
|
+
name: "newOwner",
|
|
192
|
+
type: "address",
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
name: "transferOwnership",
|
|
196
|
+
outputs: [],
|
|
197
|
+
stateMutability: "nonpayable",
|
|
198
|
+
type: "function",
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
inputs: [
|
|
202
|
+
{
|
|
203
|
+
internalType: "address",
|
|
204
|
+
name: "_token",
|
|
205
|
+
type: "address",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
internalType: "uint256",
|
|
209
|
+
name: "_amount",
|
|
210
|
+
type: "uint256",
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
internalType: "uint256",
|
|
214
|
+
name: "_abrAmount",
|
|
215
|
+
type: "uint256",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
internalType: "uint256",
|
|
219
|
+
name: "_targetId",
|
|
220
|
+
type: "uint256",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
internalType: "bytes",
|
|
224
|
+
name: "_params",
|
|
225
|
+
type: "bytes",
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
name: "transferTokensAndCallTarget",
|
|
229
|
+
outputs: [],
|
|
230
|
+
stateMutability: "payable",
|
|
231
|
+
type: "function",
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
inputs: [
|
|
235
|
+
{
|
|
236
|
+
internalType: "uint256",
|
|
237
|
+
name: "amount",
|
|
238
|
+
type: "uint256",
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
name: "withdrawGas",
|
|
242
|
+
outputs: [],
|
|
243
|
+
stateMutability: "nonpayable",
|
|
244
|
+
type: "function",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
inputs: [
|
|
248
|
+
{
|
|
249
|
+
internalType: "address",
|
|
250
|
+
name: "tokenAddress",
|
|
251
|
+
type: "address",
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
name: "withdrawTokens",
|
|
255
|
+
outputs: [],
|
|
256
|
+
stateMutability: "nonpayable",
|
|
257
|
+
type: "function",
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
stateMutability: "payable",
|
|
261
|
+
type: "receive",
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
};
|
|
265
|
+
exports.default = artifact;
|
|
266
|
+
//# sourceMappingURL=PayerWithAbr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayerWithAbr.js","sourceRoot":"","sources":["../../../../../src/services/models/abi/PayerWithAbr.ts"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG;IACf,GAAG,EAAE;QACH;YACE,MAAM,EAAE;gBACN;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,SAAS;iBAChB;aACF;YACD,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,aAAa;SACpB;QACD;YACE,SAAS,EAAE,KAAK;YAChB,M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Y;YAC7B,IAAI,EAAE,UAAU;SACjB;QACD;YACE,MAAM,EAAE;gBACN;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,SAAS;iBAChB;aACF;YACD,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,EAAE;YACX,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,UAAU;SACjB;QACD;YACE,eAAe,EAAE,SAAS;YAC1B,IAAI,EAAE,SAAS;SAChB;KACF;CACO,CAAC;AACX,kBAAe,QAAQ,CAAC","sourcesContent":["const artifact = {\n abi: [\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"_abrTokenAddress\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"_chainPrecision\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"constructor\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"previousOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n stateMutability: \"payable\",\n type: \"fallback\",\n },\n {\n inputs: [],\n name: \"abrToken\",\n outputs: [\n {\n internalType: \"contract IERC20Metadata\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"_tokenAddress\",\n type: \"address\",\n },\n {\n internalType: \"address\",\n name: \"_bridge\",\n type: \"address\",\n },\n ],\n name: \"approveBridgeToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"exchangeRate\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"_amount\",\n type: \"uint256\",\n },\n ],\n name: \"nativeTokensToAbr\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [\n {\n internalType: \"address\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"_id\",\n type: \"uint256\",\n },\n {\n internalType: \"address\",\n name: \"_target\",\n type: \"address\",\n },\n {\n internalType: \"string\",\n name: \"_signature\",\n type: \"string\",\n },\n ],\n name: \"registerTarget\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"_newExchangeRate\",\n type: \"uint256\",\n },\n ],\n name: \"setExchangeRate\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"id\",\n type: \"uint256\",\n },\n ],\n name: \"targets\",\n outputs: [\n {\n internalType: \"address\",\n name: \"target\",\n type: \"address\",\n },\n {\n internalType: \"bytes4\",\n name: \"selector\",\n type: \"bytes4\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"_token\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"_amount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"_abrAmount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"_targetId\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"_params\",\n type: \"bytes\",\n },\n ],\n name: \"transferTokensAndCallTarget\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"withdrawGas\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"tokenAddress\",\n type: \"address\",\n },\n ],\n name: \"withdrawTokens\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n stateMutability: \"payable\",\n type: \"receive\",\n },\n ],\n} as const;\nexport default artifact;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Big } from "big.js";
|
|
2
2
|
import { FeePaymentMethod } from "../../../models";
|
|
3
|
-
import {
|
|
3
|
+
import { TokenCoreFields } from "../../../tokens-info";
|
|
4
4
|
export interface ApproveParams {
|
|
5
5
|
/**
|
|
6
6
|
* The token info
|
|
7
7
|
*/
|
|
8
|
-
token:
|
|
8
|
+
token: TokenCoreFields;
|
|
9
9
|
/**
|
|
10
10
|
* The address of the token owner who is granting permission to use tokens
|
|
11
11
|
* to the spender
|
|
@@ -27,7 +27,7 @@ export interface GetTokenBalanceParams {
|
|
|
27
27
|
* The address for which we will find out the token balance
|
|
28
28
|
*/
|
|
29
29
|
account: string;
|
|
30
|
-
token:
|
|
30
|
+
token: TokenCoreFields;
|
|
31
31
|
}
|
|
32
32
|
export interface CheckAllowanceParams extends GetAllowanceParams {
|
|
33
33
|
/**
|
|
@@ -36,7 +36,7 @@ export interface CheckAllowanceParams extends GetAllowanceParams {
|
|
|
36
36
|
amount: string | number | Big;
|
|
37
37
|
}
|
|
38
38
|
export interface GetAllowanceParams {
|
|
39
|
-
token:
|
|
39
|
+
token: TokenCoreFields;
|
|
40
40
|
spender: string;
|
|
41
41
|
owner: string;
|
|
42
42
|
gasFeePaymentMethod?: FeePaymentMethod;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.model.js","sourceRoot":"","sources":["../../../../../src/services/token/models/token.model.ts"],"names":[],"mappings":"","sourcesContent":["import { Big } from \"big.js\";\nimport { FeePaymentMethod } from \"../../../models\";\nimport {
|
|
1
|
+
{"version":3,"file":"token.model.js","sourceRoot":"","sources":["../../../../../src/services/token/models/token.model.ts"],"names":[],"mappings":"","sourcesContent":["import { Big } from \"big.js\";\nimport { FeePaymentMethod } from \"../../../models\";\nimport { TokenCoreFields } from \"../../../tokens-info\";\n\nexport interface ApproveParams {\n /**\n * The token info\n */\n token: TokenCoreFields;\n\n /**\n * The address of the token owner who is granting permission to use tokens\n * to the spender\n */\n owner: string;\n\n /**\n * The address of the contract that is being granted permission to use tokens\n */\n spender: string;\n\n /**\n * The integer amount of tokens to approve.\n * Optional.\n * The maximum amount by default.\n */\n amount?: string | number | Big;\n}\n\nexport interface GetTokenBalanceParams {\n /**\n * The address for which we will find out the token balance\n */\n account: string;\n token: TokenCoreFields;\n}\n\nexport interface CheckAllowanceParams extends GetAllowanceParams {\n /**\n * The float amount of tokens to check the allowance.\n */\n amount: string | number | Big;\n}\n\nexport interface GetAllowanceParams {\n token: TokenCoreFields;\n spender: string;\n owner: string;\n gasFeePaymentMethod?: FeePaymentMethod;\n}\n\nexport interface ApproveParamsDto {\n tokenAddress: string;\n chainSymbol: string;\n owner: string;\n spender: string;\n /**\n * Integer amount of tokens to approve.\n */\n amount?: string;\n}\n\nexport type GetAllowanceParamsDto = GetAllowanceParams;\n\n/**\n * @internal\n */\nexport interface CheckAllowanceParamsDto extends GetAllowanceParamsDto {\n /**\n * The integer amount of tokens to check the allowance.\n */\n amount: string | number | Big;\n}\n"]}
|
|
@@ -9,6 +9,17 @@ import { Messenger } from "../client/core-api/core-api.model";
|
|
|
9
9
|
*/
|
|
10
10
|
export type ChainDetailsMap = Record<string, ChainDetailsWithTokens>;
|
|
11
11
|
export type ChainDetailsMapWithFlags = Record<string, ChainDetailsWithTokensWithFlags>;
|
|
12
|
+
export interface AbrPayerChainInfo {
|
|
13
|
+
/**
|
|
14
|
+
* ABR proxy for paying fees with ABR
|
|
15
|
+
*/
|
|
16
|
+
payerAddress: string;
|
|
17
|
+
abrToken: TokenCoreFields;
|
|
18
|
+
/**
|
|
19
|
+
* Availability to pay by abr
|
|
20
|
+
*/
|
|
21
|
+
payerAvailability: AbrPayerAvailability;
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* Contains some blockchain details
|
|
14
25
|
*/
|
|
@@ -38,6 +49,10 @@ export interface ChainDetails extends BasicChainProperties {
|
|
|
38
49
|
* Yield contract address
|
|
39
50
|
*/
|
|
40
51
|
yieldAddress?: string;
|
|
52
|
+
/**
|
|
53
|
+
* ABR payer chain info
|
|
54
|
+
*/
|
|
55
|
+
abrPayer?: AbrPayerChainInfo;
|
|
41
56
|
/**
|
|
42
57
|
* Average transfer time to other blockchains
|
|
43
58
|
*/
|
|
@@ -191,6 +206,7 @@ export interface TokenWithChainDetails extends Token, Omit<ChainDetails, "name">
|
|
|
191
206
|
*/
|
|
192
207
|
chainName: string;
|
|
193
208
|
}
|
|
209
|
+
export type TokenCoreFields = Pick<TokenWithChainDetails, "tokenAddress" | "chainSymbol" | "decimals" | "originTokenAddress">;
|
|
194
210
|
export interface TokenWithChainDetailsWithFlags extends TokenWithChainDetails {
|
|
195
211
|
flags: {
|
|
196
212
|
swap: boolean;
|
|
@@ -234,6 +250,7 @@ export interface PoolInfo {
|
|
|
234
250
|
*/
|
|
235
251
|
imbalance: string;
|
|
236
252
|
}
|
|
253
|
+
export type AbrPayerAvailability = Partial<Record<keyof typeof Messenger, boolean>>;
|
|
237
254
|
/**
|
|
238
255
|
* Type representing transfer times for various blockchain chains.
|
|
239
256
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens-info.model.js","sourceRoot":"","sources":["../../../src/tokens-info/tokens-info.model.ts"],"names":[],"mappings":"","sourcesContent":["import { BasicChainProperties } from \"../chains/models\";\nimport { Messenger } from \"../client/core-api/core-api.model\";\n\n/**\n * Type representing a map of blockchain chain symbols to their corresponding details, including token information.\n *\n * @typedef {Record<string, ChainDetailsWithTokens>} ChainDetailsMap\n * @property {string} chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., \"ETH\" for Ethereum). For more details, see: {@link ChainSymbol}.\n * @property {ChainDetailsWithTokens} chainDetails - The detailed information of the specified chain, including token information.\n */\nexport type ChainDetailsMap = Record<string, ChainDetailsWithTokens>;\n\nexport type ChainDetailsMapWithFlags = Record<string, ChainDetailsWithTokensWithFlags>;\n\n/**\n * Contains some blockchain details\n */\nexport interface ChainDetails extends BasicChainProperties {\n /**\n * Allbridge's Id\n */\n allbridgeChainId: number;\n /**\n * Algo Bridge appId\n */\n bridgeId?: string;\n /**\n * Algo Padding appId\n */\n paddingUtilId?: string;\n /**\n * Bridge contract address\n */\n bridgeAddress: string;\n /**\n * OFT Bridge contract address\n * Optional. Defined if the chain supports OFT\n */\n oftBridgeAddress?: string;\n /**\n * Yield contract address\n */\n yieldAddress?: string;\n /**\n * Average transfer time to other blockchains\n */\n transferTime: TransferTime;\n /**\n * Transfers costs\n */\n txCostAmount: TxCostAmount;\n /**\n * Number of confirmations required\n */\n confirmations: number;\n /**\n * Sui addresses\n * Optional. Defined for SUI\n */\n suiAddresses?: SuiAddresses;\n}\n\n/**\n * Contains tokens list\n */\nexport interface ChainDetailsWithTokens extends ChainDetails {\n /**\n * Tokens\n */\n tokens: TokenWithChainDetails[];\n}\n\n/**\n * Contains tokens list\n */\nexport interface ChainDetailsWithTokensWithFlags extends ChainDetails {\n /**\n * Tokens\n */\n tokens: TokenWithChainDetailsWithFlags[];\n}\n\n/**\n * Contains token information\n */\nexport interface Token {\n /**\n * Token symbol\n */\n symbol: string;\n /**\n * Token name\n */\n name: string;\n /**\n * Token decimals\n */\n decimals: number;\n /**\n * Token pool address\n */\n poolAddress: string;\n /**\n * Token address\n */\n tokenAddress: string;\n /**\n * Token origin address\n */\n originTokenAddress?: string;\n /**\n * Token CCTP address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpAddress?: string;\n /**\n * Token CCTP V2 address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpFeeShare?: string;\n /**\n * Token CCTP address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpV2Address?: string;\n /**\n * Token CCTP V2 address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpV2FeeShare?: string;\n /**\n * Internal identifier for the same token across different chains.\n *\n * Used to link representations of a token deployed on multiple networks (e.g., Ethereum, BSC).\n * Tokens with the same `oftId` are considered to be equivalent.\n *\n * Optional. Defined if OFT supported by token\n */\n oftId?: string;\n /**\n * Token fee share\n */\n feeShare: string;\n /**\n * @Deprecated use {@link apr7d}</br>\n * Token APR\n */\n apr: string;\n /**\n * Token APR based on last 7 days\n */\n apr7d: string;\n /**\n * Token APR based on last 30 days\n */\n apr30d: string;\n /**\n * Token LP rate\n */\n lpRate: string;\n\n yieldId?: number;\n /**\n * Sui addresses\n * Optional. Defined for SUI\n */\n suiAddresses?: SuiAddresses;\n}\n\nexport interface SuiAddresses {\n bridgeAddress: string;\n bridgeAddressOrigin?: string;\n bridgeObjectAddress: string;\n\n allbridgeMessengerAddress: string;\n allbridgeMessengerAddressOrigin?: string;\n allbridgeMessengerObjectAddress: string;\n\n gasOracleAddress: string;\n gasOracleAddressOrigin?: string;\n gasOracleObjectAddress: string;\n\n utilsAddress: string;\n\n wormholeMessengerAddress: string;\n wormholeMessengerAddressOrigin?: string;\n wormholeMessengerObjectAddress: string;\n wormholeStateObjectAddress: string;\n\n cctpAddress: string;\n cctpAddressOrigin?: string;\n cctpObjectAddress: string;\n\n cctpDenyListObjectAddress: string;\n cctpMessageTransmitterStateObjectAddress: string;\n cctpTokenMessengerMinterStateObjectAddress: string;\n cctpTreasuryObjectAddress: string;\n}\n\n/**\n * General Token Interface\n */\nexport interface TokenWithChainDetails extends Token, Omit<ChainDetails, \"name\"> {\n /**\n * Blockchain network name\n */\n chainName: string;\n}\n\nexport interface TokenWithChainDetailsWithFlags extends TokenWithChainDetails {\n flags: { swap: boolean; pool: boolean };\n}\n\n/**\n * General Pool Interface\n */\nexport interface PoolInfo {\n /**\n * Pool A value\n */\n aValue: string;\n /**\n * Pool D value\n */\n dValue: string;\n /**\n * Pool token balance\n */\n tokenBalance: string;\n /**\n * Pool virtual USD balance\n */\n vUsdBalance: string;\n /**\n * Pool total liquidity amount\n */\n totalLpAmount: string;\n /**\n * Current accumulated reward per share shifted by P bits\n */\n accRewardPerShareP: string;\n /**\n * P value, needed for accRewardPerShareP\n */\n p: number;\n /**\n * Pool imbalance\n */\n imbalance: string;\n}\n\n/**\n * Type representing transfer times for various blockchain chains.\n *\n * @typedef {Record<string, MessengerTransferTime>} TransferTime\n * @property {string} chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., \"ETH\" for Ethereum). For more details, see: {@link ChainSymbol}.\n * @property {MessengerTransferTime} transferTime - The average transfer time details for the specified chain.\n */\nexport type TransferTime = Record<string, MessengerTransferTime>;\n\n/**\n * Contains Avg transaction time withing different messenger protocols\n */\nexport type MessengerTransferTime = {\n [messenger in Messenger]?: number;\n};\n\nexport interface PoolKeyObject {\n chainSymbol: string;\n poolAddress: string;\n}\n\n/**\n * Contains transfer costs\n */\nexport interface TxCostAmount {\n /**\n * The maximum gas amount that can be received as extra gas for one transfer\n */\n maxAmount: string;\n /**\n * Swap cost\n */\n swap: string;\n /**\n * Transfer cost\n */\n transfer: string;\n}\n\nexport type PoolInfoMap = Record<string, PoolInfo>;\n"]}
|
|
1
|
+
{"version":3,"file":"tokens-info.model.js","sourceRoot":"","sources":["../../../src/tokens-info/tokens-info.model.ts"],"names":[],"mappings":"","sourcesContent":["import { BasicChainProperties } from \"../chains/models\";\nimport { Messenger } from \"../client/core-api/core-api.model\";\n\n/**\n * Type representing a map of blockchain chain symbols to their corresponding details, including token information.\n *\n * @typedef {Record<string, ChainDetailsWithTokens>} ChainDetailsMap\n * @property {string} chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., \"ETH\" for Ethereum). For more details, see: {@link ChainSymbol}.\n * @property {ChainDetailsWithTokens} chainDetails - The detailed information of the specified chain, including token information.\n */\nexport type ChainDetailsMap = Record<string, ChainDetailsWithTokens>;\n\nexport type ChainDetailsMapWithFlags = Record<string, ChainDetailsWithTokensWithFlags>;\n\nexport interface AbrPayerChainInfo {\n /**\n * ABR proxy for paying fees with ABR\n */\n payerAddress: string;\n abrToken: TokenCoreFields;\n /**\n * Availability to pay by abr\n */\n payerAvailability: AbrPayerAvailability;\n}\n\n/**\n * Contains some blockchain details\n */\nexport interface ChainDetails extends BasicChainProperties {\n /**\n * Allbridge's Id\n */\n allbridgeChainId: number;\n /**\n * Algo Bridge appId\n */\n bridgeId?: string;\n /**\n * Algo Padding appId\n */\n paddingUtilId?: string;\n /**\n * Bridge contract address\n */\n bridgeAddress: string;\n /**\n * OFT Bridge contract address\n * Optional. Defined if the chain supports OFT\n */\n oftBridgeAddress?: string;\n /**\n * Yield contract address\n */\n yieldAddress?: string;\n /**\n * ABR payer chain info\n */\n abrPayer?: AbrPayerChainInfo;\n /**\n * Average transfer time to other blockchains\n */\n transferTime: TransferTime;\n /**\n * Transfers costs\n */\n txCostAmount: TxCostAmount;\n /**\n * Number of confirmations required\n */\n confirmations: number;\n /**\n * Sui addresses\n * Optional. Defined for SUI\n */\n suiAddresses?: SuiAddresses;\n}\n\n/**\n * Contains tokens list\n */\nexport interface ChainDetailsWithTokens extends ChainDetails {\n /**\n * Tokens\n */\n tokens: TokenWithChainDetails[];\n}\n\n/**\n * Contains tokens list\n */\nexport interface ChainDetailsWithTokensWithFlags extends ChainDetails {\n /**\n * Tokens\n */\n tokens: TokenWithChainDetailsWithFlags[];\n}\n\n/**\n * Contains token information\n */\nexport interface Token {\n /**\n * Token symbol\n */\n symbol: string;\n /**\n * Token name\n */\n name: string;\n /**\n * Token decimals\n */\n decimals: number;\n /**\n * Token pool address\n */\n poolAddress: string;\n /**\n * Token address\n */\n tokenAddress: string;\n /**\n * Token origin address\n */\n originTokenAddress?: string;\n /**\n * Token CCTP address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpAddress?: string;\n /**\n * Token CCTP V2 address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpFeeShare?: string;\n /**\n * Token CCTP address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpV2Address?: string;\n /**\n * Token CCTP V2 address</br>\n * Optional. Defined if CCTP supported by token\n */\n cctpV2FeeShare?: string;\n /**\n * Internal identifier for the same token across different chains.\n *\n * Used to link representations of a token deployed on multiple networks (e.g., Ethereum, BSC).\n * Tokens with the same `oftId` are considered to be equivalent.\n *\n * Optional. Defined if OFT supported by token\n */\n oftId?: string;\n /**\n * Token fee share\n */\n feeShare: string;\n /**\n * @Deprecated use {@link apr7d}</br>\n * Token APR\n */\n apr: string;\n /**\n * Token APR based on last 7 days\n */\n apr7d: string;\n /**\n * Token APR based on last 30 days\n */\n apr30d: string;\n /**\n * Token LP rate\n */\n lpRate: string;\n\n yieldId?: number;\n /**\n * Sui addresses\n * Optional. Defined for SUI\n */\n suiAddresses?: SuiAddresses;\n}\n\nexport interface SuiAddresses {\n bridgeAddress: string;\n bridgeAddressOrigin?: string;\n bridgeObjectAddress: string;\n\n allbridgeMessengerAddress: string;\n allbridgeMessengerAddressOrigin?: string;\n allbridgeMessengerObjectAddress: string;\n\n gasOracleAddress: string;\n gasOracleAddressOrigin?: string;\n gasOracleObjectAddress: string;\n\n utilsAddress: string;\n\n wormholeMessengerAddress: string;\n wormholeMessengerAddressOrigin?: string;\n wormholeMessengerObjectAddress: string;\n wormholeStateObjectAddress: string;\n\n cctpAddress: string;\n cctpAddressOrigin?: string;\n cctpObjectAddress: string;\n\n cctpDenyListObjectAddress: string;\n cctpMessageTransmitterStateObjectAddress: string;\n cctpTokenMessengerMinterStateObjectAddress: string;\n cctpTreasuryObjectAddress: string;\n}\n\n/**\n * General Token Interface\n */\nexport interface TokenWithChainDetails extends Token, Omit<ChainDetails, \"name\"> {\n /**\n * Blockchain network name\n */\n chainName: string;\n}\n\nexport type TokenCoreFields = Pick<\n TokenWithChainDetails,\n \"tokenAddress\" | \"chainSymbol\" | \"decimals\" | \"originTokenAddress\"\n>;\n\nexport interface TokenWithChainDetailsWithFlags extends TokenWithChainDetails {\n flags: { swap: boolean; pool: boolean };\n}\n\n/**\n * General Pool Interface\n */\nexport interface PoolInfo {\n /**\n * Pool A value\n */\n aValue: string;\n /**\n * Pool D value\n */\n dValue: string;\n /**\n * Pool token balance\n */\n tokenBalance: string;\n /**\n * Pool virtual USD balance\n */\n vUsdBalance: string;\n /**\n * Pool total liquidity amount\n */\n totalLpAmount: string;\n /**\n * Current accumulated reward per share shifted by P bits\n */\n accRewardPerShareP: string;\n /**\n * P value, needed for accRewardPerShareP\n */\n p: number;\n /**\n * Pool imbalance\n */\n imbalance: string;\n}\n\nexport type AbrPayerAvailability = Partial<Record<keyof typeof Messenger, boolean>>;\n\n/**\n * Type representing transfer times for various blockchain chains.\n *\n * @typedef {Record<string, MessengerTransferTime>} TransferTime\n * @property {string} chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., \"ETH\" for Ethereum). For more details, see: {@link ChainSymbol}.\n * @property {MessengerTransferTime} transferTime - The average transfer time details for the specified chain.\n */\nexport type TransferTime = Record<string, MessengerTransferTime>;\n\n/**\n * Contains Avg transaction time withing different messenger protocols\n */\nexport type MessengerTransferTime = {\n [messenger in Messenger]?: number;\n};\n\nexport interface PoolKeyObject {\n chainSymbol: string;\n poolAddress: string;\n}\n\n/**\n * Contains transfer costs\n */\nexport interface TxCostAmount {\n /**\n * The maximum gas amount that can be received as extra gas for one transfer\n */\n maxAmount: string;\n /**\n * Swap cost\n */\n swap: string;\n /**\n * Transfer cost\n */\n transfer: string;\n}\n\nexport type PoolInfoMap = Record<string, PoolInfo>;\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Big, BigSource } from "big.js";
|
|
2
2
|
import { AllbridgeCoreClientPoolsExt } from "../client/core-api/core-client-pool-info-caching";
|
|
3
3
|
import { PoolInfo, TokenWithChainDetails } from "../tokens-info";
|
|
4
|
+
export declare function assertNever(x: never, message?: string): never;
|
|
4
5
|
export declare function getPoolInfoByToken(api: AllbridgeCoreClientPoolsExt, sourceChainToken: TokenWithChainDetails): Promise<PoolInfo>;
|
|
5
6
|
export declare function validateAmountGtZero(amount: BigSource): void;
|
|
6
7
|
export declare function validateAmountGteZero(amount: BigSource): void;
|
package/dist/src/utils/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertNever = assertNever;
|
|
3
4
|
exports.getPoolInfoByToken = getPoolInfoByToken;
|
|
4
5
|
exports.validateAmountGtZero = validateAmountGtZero;
|
|
5
6
|
exports.validateAmountGteZero = validateAmountGteZero;
|
|
@@ -9,6 +10,10 @@ exports.promiseWithTimeoutAndRetries = promiseWithTimeoutAndRetries;
|
|
|
9
10
|
exports.withExponentialBackoff = withExponentialBackoff;
|
|
10
11
|
const big_js_1 = require("big.js");
|
|
11
12
|
const exceptions_1 = require("../exceptions");
|
|
13
|
+
function assertNever(x, message) {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
15
|
+
throw new Error(message ?? `Unexpected value: ${x}`);
|
|
16
|
+
}
|
|
12
17
|
async function getPoolInfoByToken(api, sourceChainToken) {
|
|
13
18
|
return await api.getPoolInfoByKey({
|
|
14
19
|
chainSymbol: sourceChainToken.chainSymbol,
|