@talken/talkenkit 2.8.2 → 2.8.3
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/index.css +13 -13
- package/dist/index.d.ts +2 -0
- package/dist/index.js +184 -204
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +6 -6
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +7 -7
- package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/index.js +14 -14
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.d.ts +10 -21
- package/dist/wallets/walletConnectors/abcWallet/kakaoAuth.js +118 -141
- package/dist/wallets/walletConnectors/chunk-4K2V7RCL.js +96 -0
- package/dist/wallets/walletConnectors/chunk-76M232IF.js +101 -0
- package/dist/wallets/walletConnectors/chunk-CTAFZ5RQ.js +71 -0
- package/dist/wallets/walletConnectors/chunk-FE2BFYJB.js +73 -0
- package/dist/wallets/walletConnectors/chunk-GNF5CHDQ.js +102 -0
- package/dist/wallets/walletConnectors/chunk-GZPGNUNF.js +94 -0
- package/dist/wallets/walletConnectors/chunk-KNNHGFKJ.js +98 -0
- package/dist/wallets/walletConnectors/chunk-KQROIRBW.js +27 -0
- package/dist/wallets/walletConnectors/chunk-LKNK2KKU.js +76 -0
- package/dist/wallets/walletConnectors/chunk-NM7YUGLV.js +186 -0
- package/dist/wallets/walletConnectors/chunk-U5UPCM5V.js +66 -0
- package/dist/wallets/walletConnectors/chunk-WZMFQQ6R.js +108 -0
- package/dist/wallets/walletConnectors/chunk-XSJUQHR7.js +95 -0
- package/dist/wallets/walletConnectors/index.js +52 -52
- package/package.json +12 -11
- package/LICENSE +0 -9
- package/dist/wallets/walletConnectors/chunk-3LAMBKQL.js +0 -345
- package/dist/wallets/walletConnectors/chunk-55MPPI65.js +0 -492
- package/dist/wallets/walletConnectors/chunk-63H3LXPW.js +0 -58
- package/dist/wallets/walletConnectors/chunk-6BDKSA22.js +0 -341
- package/dist/wallets/walletConnectors/chunk-BF4HTXWH.js +0 -370
- package/dist/wallets/walletConnectors/chunk-EQ4EX5IN.js +0 -340
- package/dist/wallets/walletConnectors/chunk-EULIVR7N.js +0 -370
- package/dist/wallets/walletConnectors/chunk-KCB4MMIZ.js +0 -341
- package/dist/wallets/walletConnectors/chunk-LIN3ZO63.js +0 -378
- package/dist/wallets/walletConnectors/chunk-OUVRAKVV.js +0 -3050
- package/dist/wallets/walletConnectors/chunk-SKVKZ5FY.js +0 -132
- package/dist/wallets/walletConnectors/chunk-VEJS7JOC.js +0 -58
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcWallet
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-M4YGDOD5.js";
|
|
5
|
+
import "./chunk-7DLZKN46.js";
|
|
6
|
+
import "./chunk-HM73RD2O.js";
|
|
7
|
+
import "./chunk-CXWASK7L.js";
|
|
8
8
|
import "./chunk-XDNFWX2X.js";
|
|
9
9
|
import "./chunk-4Y7YP4IR.js";
|
|
10
10
|
import "./chunk-ICGK5DGY.js";
|
|
11
11
|
import "./chunk-3NWM24MH.js";
|
|
12
12
|
import "./chunk-TYJR3KGY.js";
|
|
13
|
-
import "./chunk-2LH53QET.js";
|
|
14
13
|
import "./chunk-2LOET2LX.js";
|
|
14
|
+
import "./chunk-2LH53QET.js";
|
|
15
15
|
import "./chunk-ZOBSRU6L.js";
|
|
16
16
|
import "./chunk-GFWUFYT2.js";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
} from "./chunk-
|
|
18
|
+
zerionWallet
|
|
19
|
+
} from "./chunk-55PYSSYF.js";
|
|
20
20
|
import "./chunk-YNE2UX2Z.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-3DHUDD4U.js";
|
|
22
22
|
import "./chunk-R6ZE7JAZ.js";
|
|
23
|
-
import "./chunk-YXWHHI4S.js";
|
|
24
23
|
import "./chunk-CBKU2ERC.js";
|
|
24
|
+
import "./chunk-YXWHHI4S.js";
|
|
25
25
|
import "./chunk-KXPCOVNY.js";
|
|
26
26
|
import "./chunk-2DFJ6LEN.js";
|
|
27
27
|
import "./chunk-VVXSRRXI.js";
|
|
@@ -34,20 +34,20 @@ import "./chunk-RKQS3OQG.js";
|
|
|
34
34
|
import "./chunk-NEMEHJ72.js";
|
|
35
35
|
import "./chunk-3Z5DO42M.js";
|
|
36
36
|
import {
|
|
37
|
-
|
|
38
|
-
} from "./chunk-
|
|
37
|
+
tokenaryWallet
|
|
38
|
+
} from "./chunk-AGYNSAGV.js";
|
|
39
39
|
import {
|
|
40
40
|
uniswapWallet
|
|
41
41
|
} from "./chunk-DLDZUVTB.js";
|
|
42
|
+
import {
|
|
43
|
+
talismanWallet
|
|
44
|
+
} from "./chunk-CV5HJWQX.js";
|
|
42
45
|
import {
|
|
43
46
|
valoraWallet
|
|
44
47
|
} from "./chunk-CVUEWUDI.js";
|
|
45
48
|
import {
|
|
46
49
|
walletConnectWallet
|
|
47
50
|
} from "./chunk-KU5R3WAJ.js";
|
|
48
|
-
import {
|
|
49
|
-
wigwamWallet
|
|
50
|
-
} from "./chunk-XHES3UIX.js";
|
|
51
51
|
import {
|
|
52
52
|
xdefiWallet
|
|
53
53
|
} from "./chunk-LAXV47ZW.js";
|
|
@@ -55,11 +55,14 @@ import {
|
|
|
55
55
|
zealWallet
|
|
56
56
|
} from "./chunk-NPZ2IXNP.js";
|
|
57
57
|
import {
|
|
58
|
-
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
wigwamWallet
|
|
59
|
+
} from "./chunk-XHES3UIX.js";
|
|
60
60
|
import {
|
|
61
61
|
safeWallet
|
|
62
62
|
} from "./chunk-Z2QCE6O6.js";
|
|
63
|
+
import {
|
|
64
|
+
safeheronWallet
|
|
65
|
+
} from "./chunk-GFZKT4IO.js";
|
|
63
66
|
import {
|
|
64
67
|
safepalWallet
|
|
65
68
|
} from "./chunk-6UT4SIPZ.js";
|
|
@@ -72,21 +75,21 @@ import {
|
|
|
72
75
|
import {
|
|
73
76
|
tahoWallet
|
|
74
77
|
} from "./chunk-ETH7KTEX.js";
|
|
75
|
-
import {
|
|
76
|
-
talismanWallet
|
|
77
|
-
} from "./chunk-CV5HJWQX.js";
|
|
78
78
|
import {
|
|
79
79
|
tokenPocketWallet
|
|
80
80
|
} from "./chunk-D24ZTR45.js";
|
|
81
81
|
import {
|
|
82
|
-
|
|
83
|
-
} from "./chunk-
|
|
82
|
+
trustWallet
|
|
83
|
+
} from "./chunk-PK5F7QCO.js";
|
|
84
84
|
import {
|
|
85
85
|
omniWallet
|
|
86
86
|
} from "./chunk-RGPO7AY3.js";
|
|
87
87
|
import {
|
|
88
88
|
oneKeyWallet
|
|
89
89
|
} from "./chunk-WQX4JNSR.js";
|
|
90
|
+
import {
|
|
91
|
+
paraSwapWallet
|
|
92
|
+
} from "./chunk-FF7ZXD5C.js";
|
|
90
93
|
import {
|
|
91
94
|
phantomWallet
|
|
92
95
|
} from "./chunk-M3L6IDTW.js";
|
|
@@ -103,17 +106,14 @@ import {
|
|
|
103
106
|
roninWallet
|
|
104
107
|
} from "./chunk-TP7VE6CR.js";
|
|
105
108
|
import {
|
|
106
|
-
|
|
107
|
-
} from "./chunk-
|
|
109
|
+
kresusWallet
|
|
110
|
+
} from "./chunk-CM3VR7OM.js";
|
|
108
111
|
import {
|
|
109
|
-
|
|
110
|
-
} from "./chunk-
|
|
112
|
+
metaMaskWallet
|
|
113
|
+
} from "./chunk-YYWOGELV.js";
|
|
111
114
|
import {
|
|
112
115
|
magicEdenWallet
|
|
113
116
|
} from "./chunk-6MKGDGZC.js";
|
|
114
|
-
import {
|
|
115
|
-
metaMaskWallet
|
|
116
|
-
} from "./chunk-YYWOGELV.js";
|
|
117
117
|
import {
|
|
118
118
|
mewWallet
|
|
119
119
|
} from "./chunk-T4UIU4M2.js";
|
|
@@ -129,12 +129,12 @@ import {
|
|
|
129
129
|
import {
|
|
130
130
|
oneInchWallet
|
|
131
131
|
} from "./chunk-OJT577AY.js";
|
|
132
|
-
import {
|
|
133
|
-
coin98Wallet
|
|
134
|
-
} from "./chunk-RN23EOYO.js";
|
|
135
132
|
import {
|
|
136
133
|
injectedWallet
|
|
137
134
|
} from "./chunk-DWN4FQRW.js";
|
|
135
|
+
import {
|
|
136
|
+
imTokenWallet
|
|
137
|
+
} from "./chunk-EHE2536P.js";
|
|
138
138
|
import {
|
|
139
139
|
iopayWallet
|
|
140
140
|
} from "./chunk-4KTCNBEZ.js";
|
|
@@ -151,20 +151,23 @@ import {
|
|
|
151
151
|
krakenWallet
|
|
152
152
|
} from "./chunk-CYOZFCR6.js";
|
|
153
153
|
import {
|
|
154
|
-
|
|
155
|
-
} from "./chunk-
|
|
154
|
+
ledgerWallet
|
|
155
|
+
} from "./chunk-BF3VSNPL.js";
|
|
156
|
+
import {
|
|
157
|
+
coinbaseWallet
|
|
158
|
+
} from "./chunk-PNEDRY6O.js";
|
|
156
159
|
import {
|
|
157
160
|
dawnWallet
|
|
158
161
|
} from "./chunk-GYKXFIR2.js";
|
|
159
162
|
import {
|
|
160
163
|
desigWallet
|
|
161
164
|
} from "./chunk-5DEGWPQO.js";
|
|
162
|
-
import {
|
|
163
|
-
enkryptWallet
|
|
164
|
-
} from "./chunk-UHVWJDT6.js";
|
|
165
165
|
import {
|
|
166
166
|
foxWallet
|
|
167
167
|
} from "./chunk-WJY36N2I.js";
|
|
168
|
+
import {
|
|
169
|
+
enkryptWallet
|
|
170
|
+
} from "./chunk-UHVWJDT6.js";
|
|
168
171
|
import {
|
|
169
172
|
frameWallet
|
|
170
173
|
} from "./chunk-DM3JOHQX.js";
|
|
@@ -174,27 +177,24 @@ import {
|
|
|
174
177
|
import {
|
|
175
178
|
gateWallet
|
|
176
179
|
} from "./chunk-S25DFPKE.js";
|
|
177
|
-
import {
|
|
178
|
-
imTokenWallet
|
|
179
|
-
} from "./chunk-EHE2536P.js";
|
|
180
180
|
import {
|
|
181
181
|
bitverseWallet
|
|
182
182
|
} from "./chunk-6HCSSBZY.js";
|
|
183
|
-
import {
|
|
184
|
-
braveWallet
|
|
185
|
-
} from "./chunk-7AOQK5GH.js";
|
|
186
183
|
import {
|
|
187
184
|
bloomWallet
|
|
188
185
|
} from "./chunk-3KPCADAF.js";
|
|
189
186
|
import {
|
|
190
|
-
|
|
191
|
-
} from "./chunk-
|
|
187
|
+
braveWallet
|
|
188
|
+
} from "./chunk-7AOQK5GH.js";
|
|
192
189
|
import {
|
|
193
190
|
bybitWallet
|
|
194
191
|
} from "./chunk-2AJYFWBT.js";
|
|
195
192
|
import {
|
|
196
|
-
|
|
197
|
-
} from "./chunk-
|
|
193
|
+
clvWallet
|
|
194
|
+
} from "./chunk-QHXBBEB2.js";
|
|
195
|
+
import {
|
|
196
|
+
coin98Wallet
|
|
197
|
+
} from "./chunk-RN23EOYO.js";
|
|
198
198
|
import {
|
|
199
199
|
compassWallet
|
|
200
200
|
} from "./chunk-DK4AJRIP.js";
|
|
@@ -204,26 +204,26 @@ import {
|
|
|
204
204
|
import {
|
|
205
205
|
argentWallet
|
|
206
206
|
} from "./chunk-XT2WYPN5.js";
|
|
207
|
-
import {
|
|
208
|
-
berasigWallet
|
|
209
|
-
} from "./chunk-6WB5NVHI.js";
|
|
210
207
|
import {
|
|
211
208
|
bestWallet
|
|
212
209
|
} from "./chunk-OPAPBEA5.js";
|
|
210
|
+
import {
|
|
211
|
+
berasigWallet
|
|
212
|
+
} from "./chunk-6WB5NVHI.js";
|
|
213
213
|
import {
|
|
214
214
|
bifrostWallet
|
|
215
215
|
} from "./chunk-KOZORVBW.js";
|
|
216
216
|
import {
|
|
217
217
|
binanceWallet
|
|
218
218
|
} from "./chunk-LGGIEH7O.js";
|
|
219
|
+
import {
|
|
220
|
+
bitskiWallet
|
|
221
|
+
} from "./chunk-QIR4GIBB.js";
|
|
219
222
|
import {
|
|
220
223
|
bitgetWallet
|
|
221
224
|
} from "./chunk-DKEP5NZT.js";
|
|
222
225
|
import "./chunk-RETKWSKD.js";
|
|
223
226
|
import "./chunk-PODFK4OS.js";
|
|
224
|
-
import {
|
|
225
|
-
bitskiWallet
|
|
226
|
-
} from "./chunk-QIR4GIBB.js";
|
|
227
227
|
import "./chunk-PONHGUSY.js";
|
|
228
228
|
export {
|
|
229
229
|
abcWallet,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talken/talkenkit",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.3",
|
|
4
4
|
"description": "The best way to connect a wallet 🌈 🧰",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -22,6 +22,16 @@
|
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=12.4"
|
|
24
24
|
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node build.js",
|
|
27
|
+
"build:watch": "node build.js --watch",
|
|
28
|
+
"dev": "pnpm build:watch & pnpm typegen:watch",
|
|
29
|
+
"prepare": "MINIFY_CSS=true pnpm build",
|
|
30
|
+
"prebuild": "pnpm typegen",
|
|
31
|
+
"typecheck": "pnpm tsc --noEmit",
|
|
32
|
+
"typegen": "tsc --emitDeclarationOnly || true",
|
|
33
|
+
"typegen:watch": "tsc --emitDeclarationOnly --watch"
|
|
34
|
+
},
|
|
25
35
|
"keywords": [
|
|
26
36
|
"ens",
|
|
27
37
|
"ethereum",
|
|
@@ -85,14 +95,5 @@
|
|
|
85
95
|
"type": "git",
|
|
86
96
|
"url": "git+https://github.com/talken-io/talken-kit.git",
|
|
87
97
|
"directory": "packages/talkenkit"
|
|
88
|
-
},
|
|
89
|
-
"scripts": {
|
|
90
|
-
"build": "node build.js",
|
|
91
|
-
"build:watch": "node build.js --watch",
|
|
92
|
-
"dev": "pnpm build:watch & pnpm typegen:watch",
|
|
93
|
-
"prebuild": "pnpm typegen",
|
|
94
|
-
"typecheck": "pnpm tsc --noEmit",
|
|
95
|
-
"typegen": "tsc --emitDeclarationOnly || true",
|
|
96
|
-
"typegen:watch": "tsc --emitDeclarationOnly --watch"
|
|
97
98
|
}
|
|
98
|
-
}
|
|
99
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Rainbow
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
getCredentialManager
|
|
4
|
-
} from "./chunk-YNE2UX2Z.js";
|
|
5
|
-
import {
|
|
6
|
-
AbstractChainProvider
|
|
7
|
-
} from "./chunk-SKVKZ5FY.js";
|
|
8
|
-
import {
|
|
9
|
-
ProviderErrorCode,
|
|
10
|
-
XrplProviderError
|
|
11
|
-
} from "./chunk-YXWHHI4S.js";
|
|
12
|
-
import {
|
|
13
|
-
getXrplNetwork
|
|
14
|
-
} from "./chunk-KXPCOVNY.js";
|
|
15
|
-
import {
|
|
16
|
-
createLogger
|
|
17
|
-
} from "./chunk-2DFJ6LEN.js";
|
|
18
|
-
|
|
19
|
-
// src/wallets/walletConnectors/abcWallet/abcXrplProvider.ts
|
|
20
|
-
var logger = createLogger("XrplProvider");
|
|
21
|
-
function isTalkenApiClient(client) {
|
|
22
|
-
return typeof client?.xrp?.transferXrp === "function";
|
|
23
|
-
}
|
|
24
|
-
var XRP_DECIMALS = 6;
|
|
25
|
-
var XRP_DROPS_PER_UNIT = 10 ** XRP_DECIMALS;
|
|
26
|
-
var XRPL_NETWORKS = {
|
|
27
|
-
mainnet: {
|
|
28
|
-
name: "XRP",
|
|
29
|
-
type: "xrpl",
|
|
30
|
-
explorer: "https://xrpscan.com"
|
|
31
|
-
},
|
|
32
|
-
testnet: {
|
|
33
|
-
name: "XRP Testnet",
|
|
34
|
-
type: "xrpl_testnet",
|
|
35
|
-
explorer: "https://testnet.xrpscan.com"
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var AbcXrplProvider = class extends AbstractChainProvider {
|
|
39
|
-
constructor(client) {
|
|
40
|
-
super(isTalkenApiClient(client) ? client : void 0);
|
|
41
|
-
this.network = XRPL_NETWORKS.mainnet;
|
|
42
|
-
}
|
|
43
|
-
async callInterceptor(request) {
|
|
44
|
-
if (this.requestInterceptor) {
|
|
45
|
-
await this.requestInterceptor(request);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
onWalletSet(wallet) {
|
|
49
|
-
const networkType = getXrplNetwork();
|
|
50
|
-
this.network = networkType === "xrpl" ? XRPL_NETWORKS.mainnet : XRPL_NETWORKS.testnet;
|
|
51
|
-
this.emit("connect", {
|
|
52
|
-
address: wallet.address,
|
|
53
|
-
network: this.network.type
|
|
54
|
-
});
|
|
55
|
-
logger.info(
|
|
56
|
-
"Wallet connected:",
|
|
57
|
-
`${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 6)}`
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
clearWallet() {
|
|
61
|
-
super.clearWallet();
|
|
62
|
-
logger.info("Wallet disconnected");
|
|
63
|
-
}
|
|
64
|
-
async getAddress() {
|
|
65
|
-
if (!this.wallet) {
|
|
66
|
-
throw new XrplProviderError(
|
|
67
|
-
ProviderErrorCode.DISCONNECTED,
|
|
68
|
-
"Wallet not connected"
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return this.wallet.address;
|
|
72
|
-
}
|
|
73
|
-
async getPublicKey() {
|
|
74
|
-
if (!this.wallet) {
|
|
75
|
-
throw new XrplProviderError(
|
|
76
|
-
ProviderErrorCode.DISCONNECTED,
|
|
77
|
-
"Wallet not connected"
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
return this.wallet.publicKey;
|
|
81
|
-
}
|
|
82
|
-
getNetwork() {
|
|
83
|
-
return this.network;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Send XRP/token transaction
|
|
87
|
-
* Complete flow: show confirmation → get PIN → call talken-api (create+sign+broadcast)
|
|
88
|
-
*/
|
|
89
|
-
async sendTransaction(params) {
|
|
90
|
-
if (!this.wallet) {
|
|
91
|
-
throw new XrplProviderError(
|
|
92
|
-
ProviderErrorCode.DISCONNECTED,
|
|
93
|
-
"Wallet not connected"
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
const isNative = !params.currency;
|
|
98
|
-
const symbol = isNative ? "XRP" : params.currency;
|
|
99
|
-
await this.callInterceptor({
|
|
100
|
-
chain: "xrpl",
|
|
101
|
-
method: "sendTransaction",
|
|
102
|
-
fromAddress: this.wallet.address,
|
|
103
|
-
toAddress: params.toAddress,
|
|
104
|
-
amount: params.amount,
|
|
105
|
-
symbol,
|
|
106
|
-
network: this.network.type,
|
|
107
|
-
isNativeToken: isNative,
|
|
108
|
-
feeSymbol: "XRP"
|
|
109
|
-
});
|
|
110
|
-
logger.info("Starting XRPL transaction...");
|
|
111
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
112
|
-
const pinHash = api.isAccessKeyMode() ? void 0 : getCredentialManager().getPinHash();
|
|
113
|
-
if (!pinHash && !api.isAccessKeyMode()) {
|
|
114
|
-
throw new XrplProviderError(
|
|
115
|
-
ProviderErrorCode.INTERNAL_ERROR,
|
|
116
|
-
"PIN hash not found. Please login again."
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
const email = getCredentialManager().getEmail() || void 0;
|
|
120
|
-
let amountRaw;
|
|
121
|
-
if (isNative) {
|
|
122
|
-
amountRaw = Math.floor(
|
|
123
|
-
Number.parseFloat(params.amount) * XRP_DROPS_PER_UNIT
|
|
124
|
-
).toString();
|
|
125
|
-
logger.debug(`Converting ${params.amount} XRP -> ${amountRaw} drops`);
|
|
126
|
-
} else {
|
|
127
|
-
amountRaw = params.amount;
|
|
128
|
-
}
|
|
129
|
-
const request = {
|
|
130
|
-
kind: isNative ? "native" : "fungible",
|
|
131
|
-
network: this.network.type,
|
|
132
|
-
destination: params.toAddress,
|
|
133
|
-
amount: amountRaw,
|
|
134
|
-
pin: pinHash || void 0,
|
|
135
|
-
fee: params.fee,
|
|
136
|
-
destinationTag: params.destinationTag,
|
|
137
|
-
...params.currency && { currency: params.currency },
|
|
138
|
-
...params.issuer && { issuer: params.issuer },
|
|
139
|
-
waitForConfirmation: true,
|
|
140
|
-
...email && { email }
|
|
141
|
-
};
|
|
142
|
-
this.showPendingTx({ network: this.network.type, chain: "xrpl" });
|
|
143
|
-
const result = await api.xrp.transferXrp(request);
|
|
144
|
-
const txHash = result.txHash;
|
|
145
|
-
const engineResult = result.engineResult;
|
|
146
|
-
const isSuccess = !engineResult || engineResult === "tesSUCCESS";
|
|
147
|
-
this.updateTxResult({
|
|
148
|
-
txHash,
|
|
149
|
-
network: this.network.type,
|
|
150
|
-
chain: "xrpl",
|
|
151
|
-
receipt: {
|
|
152
|
-
status: isSuccess ? 1 : 0,
|
|
153
|
-
blockNumber: null,
|
|
154
|
-
gasUsed: null
|
|
155
|
-
},
|
|
156
|
-
explorerUrl: `${this.network.explorer}/tx/${txHash}`
|
|
157
|
-
});
|
|
158
|
-
if (!isSuccess) {
|
|
159
|
-
logger.error(`XRPL transaction failed on-ledger: ${engineResult}`);
|
|
160
|
-
throw new XrplProviderError(
|
|
161
|
-
ProviderErrorCode.INTERNAL_ERROR,
|
|
162
|
-
`Transaction failed: ${engineResult}`
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
logger.info(
|
|
166
|
-
`${isNative ? "XRP" : "Token"} transaction complete:`,
|
|
167
|
-
txHash
|
|
168
|
-
);
|
|
169
|
-
this.emit("transactionBroadcasted", {
|
|
170
|
-
txHash,
|
|
171
|
-
explorerUrl: `${this.network.explorer}/tx/${txHash}`
|
|
172
|
-
});
|
|
173
|
-
return txHash;
|
|
174
|
-
} catch (error) {
|
|
175
|
-
if (error.message?.includes("cancelled") || error.message?.includes("rejected")) {
|
|
176
|
-
logger.info("User cancelled transaction");
|
|
177
|
-
throw new XrplProviderError(
|
|
178
|
-
ProviderErrorCode.USER_REJECTED,
|
|
179
|
-
"User rejected transaction",
|
|
180
|
-
error
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
logger.error("Transaction failed:", error.message);
|
|
184
|
-
this.failTxResult({
|
|
185
|
-
network: this.network.type,
|
|
186
|
-
chain: "xrpl",
|
|
187
|
-
errorMessage: error.message
|
|
188
|
-
});
|
|
189
|
-
this.emit("error", error);
|
|
190
|
-
throw new XrplProviderError(
|
|
191
|
-
ProviderErrorCode.INTERNAL_ERROR,
|
|
192
|
-
error.message || "Failed to send XRPL transaction",
|
|
193
|
-
error
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get XRP balance
|
|
199
|
-
*/
|
|
200
|
-
async getBalance() {
|
|
201
|
-
if (!this.wallet) {
|
|
202
|
-
throw new XrplProviderError(
|
|
203
|
-
ProviderErrorCode.DISCONNECTED,
|
|
204
|
-
"Wallet not connected"
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
208
|
-
const result = await api.xrp.getBalance(
|
|
209
|
-
this.network.type,
|
|
210
|
-
this.wallet.address
|
|
211
|
-
);
|
|
212
|
-
const data = result?.data ?? result;
|
|
213
|
-
return {
|
|
214
|
-
balance: data?.balance ?? "0",
|
|
215
|
-
balanceXrp: data?.balance_xrp ?? "0",
|
|
216
|
-
activated: data?.activated ?? false
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Get fungible token balances
|
|
221
|
-
*/
|
|
222
|
-
async getFtBalances(issuer) {
|
|
223
|
-
if (!this.wallet) {
|
|
224
|
-
throw new XrplProviderError(
|
|
225
|
-
ProviderErrorCode.DISCONNECTED,
|
|
226
|
-
"Wallet not connected"
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
230
|
-
const result = await api.xrp.getFtBalances(
|
|
231
|
-
this.network.type,
|
|
232
|
-
this.wallet.address,
|
|
233
|
-
issuer
|
|
234
|
-
);
|
|
235
|
-
const data = result?.data ?? result;
|
|
236
|
-
return data?.tokens ?? [];
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Estimate native XRP transfer fee
|
|
240
|
-
*/
|
|
241
|
-
async estimateFee(destination, amount) {
|
|
242
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
243
|
-
return api.xrp.getNativeFee(this.network.type, destination, amount);
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Calculate maximum sendable XRP amount
|
|
247
|
-
*/
|
|
248
|
-
async prepareMax(fee) {
|
|
249
|
-
if (!this.wallet) {
|
|
250
|
-
throw new XrplProviderError(
|
|
251
|
-
ProviderErrorCode.DISCONNECTED,
|
|
252
|
-
"Wallet not connected"
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
256
|
-
return api.xrp.getPrepareMax(this.network.type, this.wallet.address, fee);
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Check trustline status for a token
|
|
260
|
-
*/
|
|
261
|
-
async getTrustlineStatus(issuer, currency) {
|
|
262
|
-
if (!this.wallet) {
|
|
263
|
-
throw new XrplProviderError(
|
|
264
|
-
ProviderErrorCode.DISCONNECTED,
|
|
265
|
-
"Wallet not connected"
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
269
|
-
return api.xrp.getTrustlineStatus(
|
|
270
|
-
this.network.type,
|
|
271
|
-
this.wallet.address,
|
|
272
|
-
issuer,
|
|
273
|
-
currency
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Create trustline for receiving fungible tokens
|
|
278
|
-
*/
|
|
279
|
-
async createTrustline(issuer, currency, limit) {
|
|
280
|
-
if (!this.wallet) {
|
|
281
|
-
throw new XrplProviderError(
|
|
282
|
-
ProviderErrorCode.DISCONNECTED,
|
|
283
|
-
"Wallet not connected"
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
287
|
-
const pinHash = api.isAccessKeyMode() ? void 0 : getCredentialManager().getPinHash();
|
|
288
|
-
if (!pinHash && !api.isAccessKeyMode()) {
|
|
289
|
-
throw new XrplProviderError(
|
|
290
|
-
ProviderErrorCode.INTERNAL_ERROR,
|
|
291
|
-
"PIN hash not found. Please login again."
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
const email = getCredentialManager().getEmail() || void 0;
|
|
295
|
-
const result = await api.xrp.createTrustline({
|
|
296
|
-
issuer,
|
|
297
|
-
currency,
|
|
298
|
-
pin: pinHash || void 0,
|
|
299
|
-
network: this.network.type,
|
|
300
|
-
limit,
|
|
301
|
-
...email && { email }
|
|
302
|
-
});
|
|
303
|
-
if (result.engineResult && result.engineResult !== "tesSUCCESS") {
|
|
304
|
-
throw new XrplProviderError(
|
|
305
|
-
ProviderErrorCode.INTERNAL_ERROR,
|
|
306
|
-
`Trustline failed: ${result.engineResult}`
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
return result.txHash;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Validate XRP address
|
|
313
|
-
*/
|
|
314
|
-
async validateAddress(address) {
|
|
315
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
316
|
-
const result = await api.xrp.validateAddress(this.network.type, address);
|
|
317
|
-
const data = result?.data ?? result;
|
|
318
|
-
return data?.valid === true;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Get XRP server info (reserve, fee, ledger state)
|
|
322
|
-
*/
|
|
323
|
-
async getServerInfo() {
|
|
324
|
-
const api = this.getTalkenApiClientOrThrow();
|
|
325
|
-
return api.xrp.getServerInfo(this.network.type);
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Get wallet info
|
|
329
|
-
*/
|
|
330
|
-
getWalletInfo() {
|
|
331
|
-
if (!this.wallet)
|
|
332
|
-
return null;
|
|
333
|
-
return {
|
|
334
|
-
address: this.wallet.address,
|
|
335
|
-
publicKey: this.wallet.publicKey,
|
|
336
|
-
network: this.network.type
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
export {
|
|
342
|
-
XRP_DECIMALS,
|
|
343
|
-
XRPL_NETWORKS,
|
|
344
|
-
AbcXrplProvider
|
|
345
|
-
};
|