@talken/talkenkit 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AbcCredentialManager-DDHLW2IH.js → AbcCredentialManager-5W3B7GI4.js} +1 -1
- package/dist/{abcWallet-5GTT47V6.js → abcWallet-O5IRLUXL.js} +2 -2
- package/dist/{chunk-ALBABQ53.js → chunk-PN6K4CMZ.js} +4 -1
- package/dist/{chunk-REVMSQIO.js → chunk-UHZL3WSM.js} +465 -58
- package/dist/components/TransactionResultModal/TransactionResultModal.css.d.ts +17 -0
- package/dist/components/TransactionResultModal/TransactionResultModal.d.ts +9 -0
- package/dist/index.css +138 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1344 -980
- package/dist/providers/TransactionResultProvider/TransactionResultContext.d.ts +6 -0
- package/dist/providers/TransactionResultProvider/TransactionResultProvider.d.ts +7 -0
- package/dist/providers/TransactionResultProvider/TransactionResultSingleton.d.ts +16 -0
- package/dist/providers/TransactionResultProvider/index.d.ts +4 -0
- package/dist/providers/TransactionResultProvider/types.d.ts +14 -0
- package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.d.ts +29 -3
- package/dist/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.js +4 -4
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +8 -8
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.d.ts +8 -0
- package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +5 -5
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.d.ts +1 -0
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +8 -8
- package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.d.ts +1 -0
- package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +9 -9
- package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +25 -0
- package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/api/index.js +9 -9
- package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +3 -0
- package/dist/wallets/walletConnectors/abcWallet/constants.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/index.d.ts +1 -1
- package/dist/wallets/walletConnectors/abcWallet/index.js +34 -34
- package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/types.d.ts +9 -0
- package/dist/wallets/walletConnectors/abcWallet/utils.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +3 -3
- package/dist/wallets/walletConnectors/{chunk-VDWJ3NQ5.js → chunk-25ZDAJ3L.js} +1 -1
- package/dist/wallets/walletConnectors/chunk-4JZPP3S7.js +380 -0
- package/dist/wallets/walletConnectors/{chunk-HWXOTEC3.js → chunk-4YEALKXG.js} +66 -16
- package/dist/wallets/walletConnectors/{chunk-IN3HEGZM.js → chunk-645DT4TS.js} +46 -5
- package/dist/wallets/walletConnectors/{chunk-QSP2A4LA.js → chunk-6TAU7OQK.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-MO2AXXLI.js → chunk-FKI5AZVH.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-JADQLTFW.js → chunk-H2AZTZMM.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-NULM3THX.js → chunk-HWRZGGGN.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-BHEVY4QY.js → chunk-KIYXONNH.js} +35 -2
- package/dist/wallets/walletConnectors/{chunk-TQHS6APN.js → chunk-L6FCF3FH.js} +89 -7
- package/dist/wallets/walletConnectors/{chunk-ACLPF2UW.js → chunk-LIGH2LEU.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-K66HU6GX.js → chunk-OASBABPG.js} +15 -1
- package/dist/wallets/walletConnectors/{chunk-A66MTFML.js → chunk-PF65YS3T.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-6WF4SXLB.js → chunk-QKK3OPQA.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-3LF7FVL6.js → chunk-RGYZNNB6.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-DPTDOCWL.js → chunk-RX2VOIUB.js} +4 -1
- package/dist/wallets/walletConnectors/{chunk-YV6IZWGE.js → chunk-URS2KVYK.js} +45 -2
- package/dist/wallets/walletConnectors/{chunk-BXH3GDX5.js → chunk-YKFI6ZGM.js} +1 -1
- package/dist/wallets/walletConnectors/index.js +36 -36
- package/package.json +1 -1
- package/dist/wallets/walletConnectors/chunk-S2SQYPGR.js +0 -220
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TALKEN_API_ENDPOINTS,
|
|
8
8
|
TOKEN_EXPIRY,
|
|
9
9
|
getCredentialManager
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PN6K4CMZ.js";
|
|
11
11
|
|
|
12
12
|
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
13
13
|
import { setTalkenApiClient as setTalkenApiClient2 } from "@talken/talkenkit";
|
|
@@ -1092,6 +1092,7 @@ var ErrorCode = {
|
|
|
1092
1092
|
UNAUTHORIZED: 4100,
|
|
1093
1093
|
UNSUPPORTED_METHOD: 4200,
|
|
1094
1094
|
DISCONNECTED: 4900,
|
|
1095
|
+
INVALID_PARAMS: -32602,
|
|
1095
1096
|
INTERNAL_ERROR: -32603
|
|
1096
1097
|
};
|
|
1097
1098
|
var ProviderRpcError = class extends Error {
|
|
@@ -1157,77 +1158,240 @@ var AbcAccessKeyProvider = class extends EventEmitter {
|
|
|
1157
1158
|
case "eth_signTypedData":
|
|
1158
1159
|
case "eth_signTypedData_v4":
|
|
1159
1160
|
return this.signTypedData(params);
|
|
1161
|
+
case "eth_signAuthorization":
|
|
1162
|
+
return this.signAuthorization(params);
|
|
1160
1163
|
case "eth_estimateGas":
|
|
1161
|
-
return this.
|
|
1164
|
+
return this.estimateGas(params);
|
|
1162
1165
|
case "eth_getTransactionCount":
|
|
1163
|
-
return this.
|
|
1166
|
+
return this.getTransactionCount(params);
|
|
1167
|
+
case "eth_call":
|
|
1168
|
+
return this.ethCall(params);
|
|
1169
|
+
case "eth_getBalance":
|
|
1170
|
+
return this.getBalance(params);
|
|
1164
1171
|
case "wallet_getCapabilities":
|
|
1165
|
-
return {
|
|
1172
|
+
return {
|
|
1173
|
+
supportsTypedDataV4: true,
|
|
1174
|
+
supports7702Authorization: true,
|
|
1175
|
+
supports5792Batch: false,
|
|
1176
|
+
supportsPaymasterService: false,
|
|
1177
|
+
supportsPermit2RelayHints: true,
|
|
1178
|
+
walletType: "abc-embedded"
|
|
1179
|
+
};
|
|
1166
1180
|
default:
|
|
1167
|
-
|
|
1181
|
+
throw new ProviderRpcError(
|
|
1182
|
+
ErrorCode.UNSUPPORTED_METHOD,
|
|
1183
|
+
`Method not supported: ${method}`
|
|
1184
|
+
);
|
|
1168
1185
|
}
|
|
1169
1186
|
}
|
|
1170
|
-
// ── Signing
|
|
1187
|
+
// ── Signing (same endpoints as AbcEvmProvider, no PIN) ────
|
|
1188
|
+
/**
|
|
1189
|
+
* Send transaction via POST /wallet/tx/evm
|
|
1190
|
+
* PIN/email auto-injected server-side from access-key delegated credentials.
|
|
1191
|
+
*/
|
|
1171
1192
|
async sendTransaction(params) {
|
|
1172
|
-
|
|
1173
|
-
throw new ProviderRpcError(
|
|
1174
|
-
ErrorCode.UNAUTHORIZED,
|
|
1175
|
-
"Wallet not connected"
|
|
1176
|
-
);
|
|
1177
|
-
}
|
|
1193
|
+
this.ensureWallet();
|
|
1178
1194
|
const tx = params?.[0];
|
|
1179
1195
|
if (!tx) {
|
|
1180
1196
|
throw new ProviderRpcError(
|
|
1181
|
-
ErrorCode.
|
|
1197
|
+
ErrorCode.INVALID_PARAMS,
|
|
1182
1198
|
"Missing transaction params"
|
|
1183
1199
|
);
|
|
1184
1200
|
}
|
|
1201
|
+
if (!tx.to) {
|
|
1202
|
+
throw new ProviderRpcError(
|
|
1203
|
+
ErrorCode.INVALID_PARAMS,
|
|
1204
|
+
"Contract deployment (missing `to`) is not supported in access-key mode"
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1185
1207
|
const chainKey = getChainKey(this.chainId);
|
|
1186
|
-
const
|
|
1208
|
+
const hexValue = tx.value || "0x0";
|
|
1209
|
+
const amountWei = BigInt(hexValue).toString();
|
|
1210
|
+
const result = await this.apiPost("/wallet/tx/evm", {
|
|
1187
1211
|
chainKey,
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1212
|
+
to: tx.to,
|
|
1213
|
+
amountWei,
|
|
1214
|
+
data: tx.data || "0x",
|
|
1215
|
+
...tx.gas && { gasLimit: tx.gas },
|
|
1216
|
+
...tx.gasLimit && { gasLimit: tx.gasLimit },
|
|
1217
|
+
...tx.maxFeePerGas && { maxFeePerGas: tx.maxFeePerGas },
|
|
1218
|
+
...tx.maxPriorityFeePerGas && {
|
|
1219
|
+
maxPriorityFeePerGas: tx.maxPriorityFeePerGas
|
|
1220
|
+
}
|
|
1221
|
+
// No pin, no email — auto-injected by enrichWithDelegatedCredentials
|
|
1195
1222
|
});
|
|
1196
1223
|
return result?.txHash || result?.hash;
|
|
1197
1224
|
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Personal sign via POST /wallet/sign/evm/personal
|
|
1227
|
+
*/
|
|
1198
1228
|
async personalSign(params) {
|
|
1199
|
-
|
|
1229
|
+
const wallet = this.ensureWallet();
|
|
1230
|
+
const p = params;
|
|
1231
|
+
if (!Array.isArray(p) || p.length < 2) {
|
|
1232
|
+
throw new ProviderRpcError(
|
|
1233
|
+
ErrorCode.INVALID_PARAMS,
|
|
1234
|
+
"Invalid personal_sign params"
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
const [message, address] = p;
|
|
1238
|
+
if (address && address.toLowerCase() !== wallet.address.toLowerCase()) {
|
|
1200
1239
|
throw new ProviderRpcError(
|
|
1201
1240
|
ErrorCode.UNAUTHORIZED,
|
|
1202
|
-
|
|
1241
|
+
`Address mismatch: requested ${address}, connected ${wallet.address}`
|
|
1203
1242
|
);
|
|
1204
1243
|
}
|
|
1244
|
+
const network = getNetworkName(this.chainId);
|
|
1245
|
+
const result = await this.apiPost("/wallet/sign/evm/personal", {
|
|
1246
|
+
network,
|
|
1247
|
+
message,
|
|
1248
|
+
address: wallet.address
|
|
1249
|
+
// No pin — auto-injected
|
|
1250
|
+
});
|
|
1251
|
+
return result?.signature ?? result?.serializedTx ?? "";
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Sign typed data via POST /wallet/sign/evm/typed
|
|
1255
|
+
*/
|
|
1256
|
+
async signTypedData(params) {
|
|
1257
|
+
const wallet = this.ensureWallet();
|
|
1205
1258
|
const p = params;
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1259
|
+
if (!Array.isArray(p) || p.length < 2) {
|
|
1260
|
+
throw new ProviderRpcError(
|
|
1261
|
+
ErrorCode.INVALID_PARAMS,
|
|
1262
|
+
"Invalid signTypedData params"
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
const [address, typedData] = p;
|
|
1266
|
+
if (address && address.toLowerCase() !== wallet.address.toLowerCase()) {
|
|
1267
|
+
throw new ProviderRpcError(
|
|
1268
|
+
ErrorCode.UNAUTHORIZED,
|
|
1269
|
+
`Address mismatch: requested ${address}, connected ${wallet.address}`
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
const network = getNetworkName(this.chainId);
|
|
1273
|
+
const result = await this.apiPost("/wallet/sign/evm/typed", {
|
|
1274
|
+
network,
|
|
1275
|
+
typedData: typeof typedData === "string" ? typedData : JSON.stringify(typedData)
|
|
1276
|
+
// No pin — auto-injected
|
|
1211
1277
|
});
|
|
1212
1278
|
return result?.signature;
|
|
1213
1279
|
}
|
|
1214
|
-
|
|
1280
|
+
/**
|
|
1281
|
+
* Sign EIP-7702 authorization via POST /wallet/sign/authorization
|
|
1282
|
+
* Params: [address, authorization] — matches PIN mode (abcProvider.ts)
|
|
1283
|
+
*/
|
|
1284
|
+
async signAuthorization(params) {
|
|
1285
|
+
const wallet = this.ensureWallet();
|
|
1286
|
+
const p = params;
|
|
1287
|
+
if (!Array.isArray(p) || p.length < 2) {
|
|
1288
|
+
throw new ProviderRpcError(
|
|
1289
|
+
ErrorCode.INVALID_PARAMS,
|
|
1290
|
+
"Expected [address, authorization]"
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
const [address, auth] = p;
|
|
1294
|
+
if (address && address.toLowerCase() !== wallet.address.toLowerCase()) {
|
|
1295
|
+
throw new ProviderRpcError(
|
|
1296
|
+
ErrorCode.UNAUTHORIZED,
|
|
1297
|
+
`Address mismatch: requested ${address}, connected ${wallet.address}`
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
if (!auth) {
|
|
1301
|
+
throw new ProviderRpcError(
|
|
1302
|
+
ErrorCode.INVALID_PARAMS,
|
|
1303
|
+
"Missing authorization object"
|
|
1304
|
+
);
|
|
1305
|
+
}
|
|
1306
|
+
const network = getNetworkName(this.chainId);
|
|
1307
|
+
const result = await this.apiPost("/wallet/sign/authorization", {
|
|
1308
|
+
network,
|
|
1309
|
+
authorization: {
|
|
1310
|
+
chainId: auth.chainId,
|
|
1311
|
+
address: auth.address,
|
|
1312
|
+
nonce: auth.nonce?.toString()
|
|
1313
|
+
}
|
|
1314
|
+
// No pin — auto-injected
|
|
1315
|
+
});
|
|
1316
|
+
return result?.authorization || result;
|
|
1317
|
+
}
|
|
1318
|
+
// ── Helpers ───────────────────────────────────────────────
|
|
1319
|
+
ensureWallet() {
|
|
1215
1320
|
if (!this.wallet) {
|
|
1216
1321
|
throw new ProviderRpcError(
|
|
1217
1322
|
ErrorCode.UNAUTHORIZED,
|
|
1218
1323
|
"Wallet not connected"
|
|
1219
1324
|
);
|
|
1220
1325
|
}
|
|
1326
|
+
return this.wallet;
|
|
1327
|
+
}
|
|
1328
|
+
/** GET /wallet/address/balance — API uses `network` param (WaaS network name) */
|
|
1329
|
+
async getBalance(params) {
|
|
1221
1330
|
const p = params;
|
|
1222
|
-
const
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1331
|
+
const address = p?.[0] || this.wallet?.address;
|
|
1332
|
+
const network = getNetworkName(this.chainId);
|
|
1333
|
+
const result = await this.apiGet(
|
|
1334
|
+
`/wallet/address/balance?network=${network}&address=${address}`
|
|
1335
|
+
);
|
|
1336
|
+
return result?.balance ?? "0x0";
|
|
1337
|
+
}
|
|
1338
|
+
/** GET /wallet/nonce — API uses `network` param (WaaS network name) */
|
|
1339
|
+
async getTransactionCount(params) {
|
|
1340
|
+
const p = params;
|
|
1341
|
+
const address = p?.[0] || this.wallet?.address;
|
|
1342
|
+
const network = getNetworkName(this.chainId);
|
|
1343
|
+
const result = await this.apiGet(
|
|
1344
|
+
`/wallet/nonce?network=${network}&address=${address}`
|
|
1345
|
+
);
|
|
1346
|
+
const nonce = result?.nonce ?? 0;
|
|
1347
|
+
return `0x${Number(nonce).toString(16)}`;
|
|
1348
|
+
}
|
|
1349
|
+
/** POST /wallet/contract/eth-call */
|
|
1350
|
+
async ethCall(params) {
|
|
1351
|
+
const p = params;
|
|
1352
|
+
const tx = p?.[0];
|
|
1353
|
+
const network = getNetworkName(this.chainId);
|
|
1354
|
+
const result = await this.apiPost("/wallet/contract/eth-call", {
|
|
1355
|
+
network,
|
|
1356
|
+
to: tx?.to,
|
|
1357
|
+
data: tx?.data,
|
|
1358
|
+
from: tx?.from || this.wallet?.address
|
|
1227
1359
|
});
|
|
1228
|
-
return result?.
|
|
1360
|
+
return result?.result ?? result?.data ?? "0x";
|
|
1361
|
+
}
|
|
1362
|
+
/** POST /wallet/tx/evm with dry-run for gas estimation */
|
|
1363
|
+
async estimateGas(params) {
|
|
1364
|
+
const p = params;
|
|
1365
|
+
const tx = p?.[0];
|
|
1366
|
+
try {
|
|
1367
|
+
const result = await this.apiPost("/wallet/contract/eth-call", {
|
|
1368
|
+
network: getNetworkName(this.chainId),
|
|
1369
|
+
to: tx?.to,
|
|
1370
|
+
data: tx?.data,
|
|
1371
|
+
from: tx?.from || this.wallet?.address,
|
|
1372
|
+
value: tx?.value,
|
|
1373
|
+
estimateGas: true
|
|
1374
|
+
});
|
|
1375
|
+
return result?.gasEstimate ?? result?.gas ?? "0x5208";
|
|
1376
|
+
} catch {
|
|
1377
|
+
return "0x5208";
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
async apiGet(path) {
|
|
1381
|
+
const url = `${this.apiBaseUrl}${path}`;
|
|
1382
|
+
const res = await fetch(url, {
|
|
1383
|
+
headers: { "X-Access-Key": this.accessKey }
|
|
1384
|
+
});
|
|
1385
|
+
if (!res.ok) {
|
|
1386
|
+
const err = await res.json().catch(() => ({ message: res.statusText }));
|
|
1387
|
+
throw new ProviderRpcError(
|
|
1388
|
+
ErrorCode.INTERNAL_ERROR,
|
|
1389
|
+
err?.error?.message || err?.message || `API error: ${res.status}`
|
|
1390
|
+
);
|
|
1391
|
+
}
|
|
1392
|
+
const json = await res.json();
|
|
1393
|
+
return json?.data || json;
|
|
1229
1394
|
}
|
|
1230
|
-
// ── HTTP helpers ──────────────────────────────────────────
|
|
1231
1395
|
async apiPost(path, body) {
|
|
1232
1396
|
const url = `${this.apiBaseUrl}${path}`;
|
|
1233
1397
|
const res = await fetch(url, {
|
|
@@ -1248,15 +1412,14 @@ var AbcAccessKeyProvider = class extends EventEmitter {
|
|
|
1248
1412
|
const json = await res.json();
|
|
1249
1413
|
return json?.data || json;
|
|
1250
1414
|
}
|
|
1251
|
-
async rpcCall(method, params) {
|
|
1252
|
-
const chainKey = getChainKey(this.chainId);
|
|
1253
|
-
const result = await this.apiPost("/rpc", { chainKey, method, params });
|
|
1254
|
-
return result?.result ?? result;
|
|
1255
|
-
}
|
|
1256
1415
|
};
|
|
1257
1416
|
|
|
1258
1417
|
// src/wallets/walletConnectors/abcWallet/abcProvider.ts
|
|
1259
|
-
import {
|
|
1418
|
+
import {
|
|
1419
|
+
getShowPendingTransaction,
|
|
1420
|
+
getTalkenApiClient,
|
|
1421
|
+
getUpdateTransactionResult
|
|
1422
|
+
} from "@talken/talkenkit";
|
|
1260
1423
|
import { parseGwei } from "viem";
|
|
1261
1424
|
var EventEmitter2 = class {
|
|
1262
1425
|
constructor() {
|
|
@@ -1501,10 +1664,12 @@ var AbcEvmProvider = class extends EventEmitter2 {
|
|
|
1501
1664
|
return this.eth_getTransactionCount(
|
|
1502
1665
|
Array.isArray(params) ? params : []
|
|
1503
1666
|
);
|
|
1504
|
-
case "eth_blockNumber":
|
|
1505
1667
|
case "eth_call":
|
|
1506
|
-
|
|
1668
|
+
return this.eth_call(params);
|
|
1507
1669
|
case "eth_getBalance":
|
|
1670
|
+
return this.eth_getBalance(params);
|
|
1671
|
+
case "eth_blockNumber":
|
|
1672
|
+
case "eth_gasPrice":
|
|
1508
1673
|
case "eth_getBlockByHash":
|
|
1509
1674
|
case "eth_getBlockByNumber":
|
|
1510
1675
|
case "eth_getCode":
|
|
@@ -1627,10 +1792,20 @@ var AbcEvmProvider = class extends EventEmitter2 {
|
|
|
1627
1792
|
const hexValue = tx.value || "0x0";
|
|
1628
1793
|
const amountWei = BigInt(hexValue).toString();
|
|
1629
1794
|
const email = this.getRecoveryEmail();
|
|
1795
|
+
const chainKey = getChainKey(this.chainId);
|
|
1796
|
+
const showPending = getShowPendingTransaction();
|
|
1797
|
+
if (showPending) {
|
|
1798
|
+
showPending({
|
|
1799
|
+
txHash: "",
|
|
1800
|
+
network: chainKey,
|
|
1801
|
+
chain: "evm",
|
|
1802
|
+
explorerUrl: void 0
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1630
1805
|
const api = this.getTalkenApiClientOrThrow();
|
|
1631
1806
|
const result = await this.withSigningCredentialRetry(
|
|
1632
1807
|
() => api.evm.sendTransaction({
|
|
1633
|
-
chainKey
|
|
1808
|
+
chainKey,
|
|
1634
1809
|
to: tx.to,
|
|
1635
1810
|
amountWei,
|
|
1636
1811
|
pin: pinHash,
|
|
@@ -1638,9 +1813,20 @@ var AbcEvmProvider = class extends EventEmitter2 {
|
|
|
1638
1813
|
gasLimit: tx.gas || tx.gasLimit,
|
|
1639
1814
|
maxFeePerGas: tx.maxFeePerGas,
|
|
1640
1815
|
maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
|
|
1816
|
+
waitForReceipt: true,
|
|
1641
1817
|
...email && { email }
|
|
1642
1818
|
})
|
|
1643
1819
|
);
|
|
1820
|
+
const updateResult = getUpdateTransactionResult();
|
|
1821
|
+
if (updateResult) {
|
|
1822
|
+
updateResult({
|
|
1823
|
+
txHash: result.txHash,
|
|
1824
|
+
network: chainKey,
|
|
1825
|
+
chain: "evm",
|
|
1826
|
+
receipt: result.receipt ?? null,
|
|
1827
|
+
explorerUrl: getExplorerTxUrl(this.chainId, result.txHash)
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1644
1830
|
return result.txHash;
|
|
1645
1831
|
}
|
|
1646
1832
|
/**
|
|
@@ -1971,6 +2157,60 @@ var AbcEvmProvider = class extends EventEmitter2 {
|
|
|
1971
2157
|
return "0x5208";
|
|
1972
2158
|
}
|
|
1973
2159
|
}
|
|
2160
|
+
/**
|
|
2161
|
+
* Execute read-only eth_call via talken-api
|
|
2162
|
+
*/
|
|
2163
|
+
async eth_call(params) {
|
|
2164
|
+
const p = Array.isArray(params) ? params : [];
|
|
2165
|
+
const tx = p[0];
|
|
2166
|
+
if (!tx?.to || !tx?.data) {
|
|
2167
|
+
throw new ProviderRpcError2(
|
|
2168
|
+
ErrorCode2.INVALID_PARAMS,
|
|
2169
|
+
"eth_call requires to and data"
|
|
2170
|
+
);
|
|
2171
|
+
}
|
|
2172
|
+
try {
|
|
2173
|
+
const api = this.getTalkenApiClientOrThrow();
|
|
2174
|
+
const response = await api.evm.ethCall({
|
|
2175
|
+
network: getNetworkName(this.chainId),
|
|
2176
|
+
to: tx.to,
|
|
2177
|
+
data: tx.data,
|
|
2178
|
+
from: tx.from || this.wallet?.address
|
|
2179
|
+
});
|
|
2180
|
+
return response?.result ?? response?.data ?? "0x";
|
|
2181
|
+
} catch (error) {
|
|
2182
|
+
throw new ProviderRpcError2(
|
|
2183
|
+
ErrorCode2.INTERNAL_ERROR,
|
|
2184
|
+
`eth_call failed: ${error instanceof Error ? error.message : String(error)}`
|
|
2185
|
+
);
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Get native balance via talken-api
|
|
2190
|
+
*/
|
|
2191
|
+
async eth_getBalance(params) {
|
|
2192
|
+
const p = Array.isArray(params) ? params : [];
|
|
2193
|
+
const address = p[0] || this.wallet?.address;
|
|
2194
|
+
if (!address) {
|
|
2195
|
+
throw new ProviderRpcError2(
|
|
2196
|
+
ErrorCode2.INVALID_PARAMS,
|
|
2197
|
+
"Missing address parameter"
|
|
2198
|
+
);
|
|
2199
|
+
}
|
|
2200
|
+
try {
|
|
2201
|
+
const api = this.getTalkenApiClientOrThrow();
|
|
2202
|
+
const response = await api.evm.getBalance(
|
|
2203
|
+
getNetworkName(this.chainId),
|
|
2204
|
+
address
|
|
2205
|
+
);
|
|
2206
|
+
return response?.balance ?? "0x0";
|
|
2207
|
+
} catch (error) {
|
|
2208
|
+
throw new ProviderRpcError2(
|
|
2209
|
+
ErrorCode2.INTERNAL_ERROR,
|
|
2210
|
+
`eth_getBalance failed: ${error instanceof Error ? error.message : String(error)}`
|
|
2211
|
+
);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
1974
2214
|
/**
|
|
1975
2215
|
* Check if connected
|
|
1976
2216
|
*/
|
|
@@ -2349,6 +2589,21 @@ var TalkenEvmModule = class {
|
|
|
2349
2589
|
const qs = new URLSearchParams({ network, address }).toString();
|
|
2350
2590
|
return this.client.get(`${TALKEN_API_ENDPOINTS.NONCE}?${qs}`);
|
|
2351
2591
|
}
|
|
2592
|
+
/**
|
|
2593
|
+
* Get native balance for address
|
|
2594
|
+
* GET /wallet/address/balance?network=&address=
|
|
2595
|
+
*/
|
|
2596
|
+
async getBalance(network, address) {
|
|
2597
|
+
const qs = new URLSearchParams({ network, address }).toString();
|
|
2598
|
+
return this.client.get(`${TALKEN_API_ENDPOINTS.ADDRESS_BALANCE}?${qs}`);
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Execute read-only eth_call
|
|
2602
|
+
* POST /wallet/contract/eth-call { network, to, data, from? }
|
|
2603
|
+
*/
|
|
2604
|
+
async ethCall(params) {
|
|
2605
|
+
return this.client.post(TALKEN_API_ENDPOINTS.ETH_CALL, params);
|
|
2606
|
+
}
|
|
2352
2607
|
};
|
|
2353
2608
|
var TalkenSolanaModule = class {
|
|
2354
2609
|
constructor(client) {
|
|
@@ -2520,6 +2775,24 @@ var TalkenTronModule = class {
|
|
|
2520
2775
|
params
|
|
2521
2776
|
);
|
|
2522
2777
|
}
|
|
2778
|
+
/**
|
|
2779
|
+
* Get TRON account info (balance, resource, permissions)
|
|
2780
|
+
* GET /wallet/tron?mode=account&network=&address=
|
|
2781
|
+
*/
|
|
2782
|
+
async getAccount(network, address) {
|
|
2783
|
+
return this.client.get(
|
|
2784
|
+
`${TALKEN_API_ENDPOINTS.TRON_UTIL}?mode=account&network=${encodeURIComponent(network)}&address=${encodeURIComponent(address)}`
|
|
2785
|
+
);
|
|
2786
|
+
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Get TRC20 token balance
|
|
2789
|
+
* GET /wallet/tron?mode=trc20Balance&network=&address=&contractAddress=
|
|
2790
|
+
*/
|
|
2791
|
+
async getTrc20Balance(network, address, contractAddress) {
|
|
2792
|
+
return this.client.get(
|
|
2793
|
+
`${TALKEN_API_ENDPOINTS.TRON_UTIL}?mode=trc20Balance&network=${encodeURIComponent(network)}&address=${encodeURIComponent(address)}&contractAddress=${encodeURIComponent(contractAddress)}`
|
|
2794
|
+
);
|
|
2795
|
+
}
|
|
2523
2796
|
};
|
|
2524
2797
|
var TalkenWalletscanModule = class {
|
|
2525
2798
|
constructor(client) {
|
|
@@ -2949,13 +3222,59 @@ function abcConnector(options) {
|
|
|
2949
3222
|
if (!authState || !authState.isAuthenticated || !authState.wallet) {
|
|
2950
3223
|
throw new Error("ABC_LOGIN_REQUIRED");
|
|
2951
3224
|
}
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
3225
|
+
if (isAccessKeyMode) {
|
|
3226
|
+
let w = authState.wallet;
|
|
3227
|
+
if (!w.uid || !w.sessionId) {
|
|
3228
|
+
try {
|
|
3229
|
+
const apiUrl = resolveTalkenApiUrl(config.talkenApiUrl);
|
|
3230
|
+
const res = await fetch(`${apiUrl}/wallet/mpc`, {
|
|
3231
|
+
method: "POST",
|
|
3232
|
+
headers: {
|
|
3233
|
+
"Content-Type": "application/json",
|
|
3234
|
+
"X-Access-Key": config.accessKey
|
|
3235
|
+
},
|
|
3236
|
+
body: JSON.stringify({ action: "info" })
|
|
3237
|
+
});
|
|
3238
|
+
const data = await res.json();
|
|
3239
|
+
const acct = data?.data?.accounts?.[0] || data?.data;
|
|
3240
|
+
if (acct?.ethAddress || acct?.address) {
|
|
3241
|
+
w = {
|
|
3242
|
+
address: acct.ethAddress || acct.address || w.address,
|
|
3243
|
+
chainId: w.chainId || config.defaultChainId || 1,
|
|
3244
|
+
uid: acct.uid || data?.data?.uid || "",
|
|
3245
|
+
sessionId: acct.sid || acct.sessionId || "",
|
|
3246
|
+
keyId: acct.keyId || (acct.wid != null ? String(acct.wid) : "") || (data?.data?.wid != null ? String(data.data.wid) : ""),
|
|
3247
|
+
encryptedShare: acct.encryptedShare || acct.pvencstr || "",
|
|
3248
|
+
sid: acct.sid || "",
|
|
3249
|
+
type: "evm",
|
|
3250
|
+
email: authState.user?.email || acct.email || data?.data?.email || ""
|
|
3251
|
+
};
|
|
3252
|
+
saveAuthState({ ...authState, wallet: w });
|
|
3253
|
+
}
|
|
3254
|
+
} catch (_) {
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
const fullWallet = {
|
|
3258
|
+
address: w.address,
|
|
3259
|
+
chainId: w.chainId || config.defaultChainId || 1,
|
|
3260
|
+
uid: w.uid || "",
|
|
3261
|
+
sessionId: w.sessionId || "",
|
|
3262
|
+
keyId: w.keyId || "",
|
|
3263
|
+
encryptedShare: w.encryptedShare || "",
|
|
3264
|
+
sid: w.sid || "",
|
|
3265
|
+
type: "evm",
|
|
3266
|
+
email: w.email || authState.user?.email || ""
|
|
3267
|
+
};
|
|
3268
|
+
provider.setWallet(fullWallet);
|
|
3269
|
+
} else {
|
|
3270
|
+
provider.setWallet(authState.wallet);
|
|
3271
|
+
if (authState.accessToken && authState.refreshToken && authState.expiresAt) {
|
|
3272
|
+
talkenApi.setTokens(
|
|
3273
|
+
authState.accessToken,
|
|
3274
|
+
authState.refreshToken,
|
|
3275
|
+
authState.expiresAt
|
|
3276
|
+
);
|
|
3277
|
+
}
|
|
2959
3278
|
}
|
|
2960
3279
|
const accounts = await provider.request({
|
|
2961
3280
|
method: "eth_requestAccounts"
|
|
@@ -3076,8 +3395,12 @@ function abcConnector(options) {
|
|
|
3076
3395
|
*/
|
|
3077
3396
|
async isAuthorized() {
|
|
3078
3397
|
try {
|
|
3079
|
-
if (isAccessKeyMode
|
|
3080
|
-
|
|
3398
|
+
if (isAccessKeyMode) {
|
|
3399
|
+
if (provider.isConnected())
|
|
3400
|
+
return true;
|
|
3401
|
+
const hasKey = !!config.accessKey || typeof localStorage !== "undefined" && !!localStorage.getItem("talken_ak");
|
|
3402
|
+
const authState2 = loadAuthState();
|
|
3403
|
+
return hasKey && !!authState2?.wallet?.address;
|
|
3081
3404
|
}
|
|
3082
3405
|
const authState = loadAuthState();
|
|
3083
3406
|
if (!authState || !authState.isAuthenticated) {
|
|
@@ -4587,7 +4910,11 @@ function createAbcBitcoinConnector(config) {
|
|
|
4587
4910
|
}
|
|
4588
4911
|
|
|
4589
4912
|
// src/wallets/walletConnectors/abcWallet/abcSolanaProvider.ts
|
|
4590
|
-
import {
|
|
4913
|
+
import {
|
|
4914
|
+
getShowPendingTransaction as getShowPendingTransaction2,
|
|
4915
|
+
getTalkenApiClient as getTalkenApiClient12,
|
|
4916
|
+
getUpdateTransactionResult as getUpdateTransactionResult2
|
|
4917
|
+
} from "@talken/talkenkit";
|
|
4591
4918
|
|
|
4592
4919
|
// src/utils/apiClientFactory.ts
|
|
4593
4920
|
function createWalletscanApi() {
|
|
@@ -4923,6 +5250,15 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
4923
5250
|
});
|
|
4924
5251
|
const api = this.getTalkenApiClientOrThrow();
|
|
4925
5252
|
const apiNetwork = this.wallet.network === "solana" ? "solana" : "solana_devnet";
|
|
5253
|
+
const showPending = getShowPendingTransaction2();
|
|
5254
|
+
if (showPending) {
|
|
5255
|
+
showPending({
|
|
5256
|
+
txHash: "",
|
|
5257
|
+
network: apiNetwork,
|
|
5258
|
+
chain: "solana",
|
|
5259
|
+
explorerUrl: void 0
|
|
5260
|
+
});
|
|
5261
|
+
}
|
|
4926
5262
|
if (params.mintAddress) {
|
|
4927
5263
|
const walletscanApi = createWalletscanApi();
|
|
4928
5264
|
const tokenMeta = await walletscanApi.getContractTokenWithTimeout({
|
|
@@ -4938,9 +5274,11 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
4938
5274
|
amount: String(rawAmount),
|
|
4939
5275
|
decimals,
|
|
4940
5276
|
network: apiNetwork,
|
|
4941
|
-
pin: pinHash
|
|
5277
|
+
pin: pinHash,
|
|
5278
|
+
waitForConfirmation: true
|
|
4942
5279
|
});
|
|
4943
5280
|
console.log("[AbcSolanaProvider] SPL transfer result:", result2);
|
|
5281
|
+
this.updateTransactionResult(result2, apiNetwork);
|
|
4944
5282
|
return { signature: result2.txHash };
|
|
4945
5283
|
}
|
|
4946
5284
|
const { LAMPORTS_PER_SOL } = await import("@solana/web3.js");
|
|
@@ -4955,9 +5293,11 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
4955
5293
|
toAddress: params.toAddress,
|
|
4956
5294
|
amountLamports: String(amountLamports),
|
|
4957
5295
|
network: apiNetwork,
|
|
4958
|
-
pin: pinHash
|
|
5296
|
+
pin: pinHash,
|
|
5297
|
+
waitForConfirmation: true
|
|
4959
5298
|
});
|
|
4960
5299
|
console.log("[AbcSolanaProvider] native transfer result:", result);
|
|
5300
|
+
this.updateTransactionResult(result, apiNetwork);
|
|
4961
5301
|
return { signature: result.txHash };
|
|
4962
5302
|
} catch (error) {
|
|
4963
5303
|
console.error("[AbcSolanaProvider] transfer FAILED:", {
|
|
@@ -5030,10 +5370,38 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
5030
5370
|
);
|
|
5031
5371
|
}
|
|
5032
5372
|
}
|
|
5373
|
+
updateTransactionResult(result, network) {
|
|
5374
|
+
const updateResult = getUpdateTransactionResult2();
|
|
5375
|
+
if (!updateResult)
|
|
5376
|
+
return;
|
|
5377
|
+
let receipt = result.receipt;
|
|
5378
|
+
if (!receipt && result.confirmation) {
|
|
5379
|
+
const data = result.confirmation?.data?.result ?? result.confirmation?.result ?? result.confirmation;
|
|
5380
|
+
const slot = data?.slot;
|
|
5381
|
+
const meta = data?.meta;
|
|
5382
|
+
receipt = {
|
|
5383
|
+
status: meta?.err === null ? 1 : 0,
|
|
5384
|
+
blockNumber: slot ?? null,
|
|
5385
|
+
gasUsed: meta?.fee != null ? String(meta.fee) : null
|
|
5386
|
+
};
|
|
5387
|
+
}
|
|
5388
|
+
const cluster = network.includes("devnet") ? "?cluster=devnet" : "";
|
|
5389
|
+
updateResult({
|
|
5390
|
+
txHash: result.txHash,
|
|
5391
|
+
network,
|
|
5392
|
+
chain: "solana",
|
|
5393
|
+
receipt,
|
|
5394
|
+
explorerUrl: `https://explorer.solana.com/tx/${result.txHash}${cluster}`
|
|
5395
|
+
});
|
|
5396
|
+
}
|
|
5033
5397
|
};
|
|
5034
5398
|
|
|
5035
5399
|
// src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
|
|
5036
|
-
import {
|
|
5400
|
+
import {
|
|
5401
|
+
getShowPendingTransaction as getShowPendingTransaction3,
|
|
5402
|
+
getTalkenApiClient as getTalkenApiClient13,
|
|
5403
|
+
getUpdateTransactionResult as getUpdateTransactionResult3
|
|
5404
|
+
} from "@talken/talkenkit";
|
|
5037
5405
|
import { keccak256 } from "viem";
|
|
5038
5406
|
function isTalkenApiClient2(client) {
|
|
5039
5407
|
return typeof client?.tron?.transferTrx === "function";
|
|
@@ -5354,6 +5722,7 @@ ${msgBytes.length}`
|
|
|
5354
5722
|
toAddress: params.toAddress,
|
|
5355
5723
|
amountSun: amountRaw,
|
|
5356
5724
|
pin: pinHash,
|
|
5725
|
+
waitForConfirmation: true,
|
|
5357
5726
|
...email && { email }
|
|
5358
5727
|
} : {
|
|
5359
5728
|
kind: "trc20",
|
|
@@ -5363,10 +5732,21 @@ ${msgBytes.length}`
|
|
|
5363
5732
|
amount: amountRaw,
|
|
5364
5733
|
feeLimit: params.feeLimit,
|
|
5365
5734
|
pin: pinHash,
|
|
5735
|
+
waitForConfirmation: true,
|
|
5366
5736
|
...email && { email }
|
|
5367
5737
|
};
|
|
5738
|
+
const showPending = getShowPendingTransaction3();
|
|
5739
|
+
if (showPending) {
|
|
5740
|
+
showPending({
|
|
5741
|
+
txHash: "",
|
|
5742
|
+
network: this.network.type,
|
|
5743
|
+
chain: "tron",
|
|
5744
|
+
explorerUrl: void 0
|
|
5745
|
+
});
|
|
5746
|
+
}
|
|
5368
5747
|
const result = await api.tron.transferTrx(request);
|
|
5369
5748
|
const txHash = result.txHash;
|
|
5749
|
+
this.updateTransactionResult(result);
|
|
5370
5750
|
console.log(
|
|
5371
5751
|
`[TronProvider] \u2705 ${txType === "NATIVE" ? "TRX" : "TRC-20"} transaction complete via TalkenApiClient:`,
|
|
5372
5752
|
txHash
|
|
@@ -5413,6 +5793,33 @@ ${msgBytes.length}`
|
|
|
5413
5793
|
network: this.network.type
|
|
5414
5794
|
};
|
|
5415
5795
|
}
|
|
5796
|
+
updateTransactionResult(result) {
|
|
5797
|
+
const updateResult = getUpdateTransactionResult3();
|
|
5798
|
+
if (!updateResult)
|
|
5799
|
+
return;
|
|
5800
|
+
let receipt = result.receipt;
|
|
5801
|
+
if (!receipt && result.confirmation) {
|
|
5802
|
+
const conf = result.confirmation;
|
|
5803
|
+
const info = conf?.info ?? conf;
|
|
5804
|
+
const tx = conf?.transaction ?? conf;
|
|
5805
|
+
const blockNumber = info?.blockNumber ?? info?.result?.blockNumber ?? null;
|
|
5806
|
+
const rcpt = info?.receipt ?? info?.result?.receipt;
|
|
5807
|
+
const ret = tx?.ret ?? tx?.result?.ret;
|
|
5808
|
+
const contractRet = Array.isArray(ret) ? ret[0]?.contractRet : void 0;
|
|
5809
|
+
receipt = {
|
|
5810
|
+
status: contractRet === "SUCCESS" ? 1 : contractRet ? 0 : null,
|
|
5811
|
+
blockNumber,
|
|
5812
|
+
gasUsed: rcpt?.energy_usage_total != null ? String(rcpt.energy_usage_total) : null
|
|
5813
|
+
};
|
|
5814
|
+
}
|
|
5815
|
+
updateResult({
|
|
5816
|
+
txHash: result.txHash,
|
|
5817
|
+
network: this.network.type,
|
|
5818
|
+
chain: "tron",
|
|
5819
|
+
receipt,
|
|
5820
|
+
explorerUrl: `${this.network.explorer}/#/transaction/${result.txHash}`
|
|
5821
|
+
});
|
|
5822
|
+
}
|
|
5416
5823
|
};
|
|
5417
5824
|
|
|
5418
5825
|
// src/wallets/walletConnectors/abcWallet/walletGeneration.ts
|