@talken/talkenkit 2.5.0 → 2.5.2
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-HRNBHY5Q.js} +2 -2
- package/dist/{chunk-ALBABQ53.js → chunk-PN6K4CMZ.js} +4 -1
- package/dist/{chunk-REVMSQIO.js → chunk-VCQZZ6SN.js} +478 -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 +1341 -977
- 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 +21 -21
- 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-HWXOTEC3.js → chunk-2A5XTST5.js} +64 -14
- package/dist/wallets/walletConnectors/chunk-4JZPP3S7.js +380 -0
- package/dist/wallets/walletConnectors/{chunk-QSP2A4LA.js → chunk-4PDTJS5L.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IN3HEGZM.js → chunk-645DT4TS.js} +46 -5
- package/dist/wallets/walletConnectors/{chunk-BHEVY4QY.js → chunk-ASYCOXE6.js} +50 -4
- package/dist/wallets/walletConnectors/chunk-BRXYKYKT.js +360 -0
- 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-IPH3SIC3.js +57 -0
- package/dist/wallets/walletConnectors/chunk-JBOKTW2Q.js +360 -0
- 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-MIX4TRKO.js +194 -0
- package/dist/wallets/walletConnectors/chunk-NP5PWUVU.js +873 -0
- 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-TVZHPWFR.js +843 -0
- package/dist/wallets/walletConnectors/{chunk-YV6IZWGE.js → chunk-URS2KVYK.js} +45 -2
- package/dist/wallets/walletConnectors/chunk-WKP53WWR.js +57 -0
- package/dist/wallets/walletConnectors/{chunk-BXH3GDX5.js → chunk-YKFI6ZGM.js} +1 -1
- package/dist/wallets/walletConnectors/index.js +48 -48
- 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) {
|
|
@@ -2699,6 +2972,19 @@ var TalkenApiClient = class {
|
|
|
2699
2972
|
};
|
|
2700
2973
|
if (!skipAuth && this.accessToken) {
|
|
2701
2974
|
headers.Authorization = `Bearer ${this.accessToken}`;
|
|
2975
|
+
} else if (!skipAuth) {
|
|
2976
|
+
const ak = loadToken("access_key_raw");
|
|
2977
|
+
const tgAk = !ak && typeof window !== "undefined" ? (() => {
|
|
2978
|
+
try {
|
|
2979
|
+
return localStorage.getItem("talken_ak");
|
|
2980
|
+
} catch {
|
|
2981
|
+
return null;
|
|
2982
|
+
}
|
|
2983
|
+
})() : null;
|
|
2984
|
+
const effectiveAk = ak || tgAk;
|
|
2985
|
+
if (effectiveAk) {
|
|
2986
|
+
headers["X-Access-Key"] = effectiveAk;
|
|
2987
|
+
}
|
|
2702
2988
|
}
|
|
2703
2989
|
if (this.config.debug) {
|
|
2704
2990
|
console.log(`[TalkenApiClient] ${method} ${url}`);
|
|
@@ -2949,13 +3235,59 @@ function abcConnector(options) {
|
|
|
2949
3235
|
if (!authState || !authState.isAuthenticated || !authState.wallet) {
|
|
2950
3236
|
throw new Error("ABC_LOGIN_REQUIRED");
|
|
2951
3237
|
}
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
3238
|
+
if (isAccessKeyMode) {
|
|
3239
|
+
let w = authState.wallet;
|
|
3240
|
+
if (!w.uid || !w.sessionId) {
|
|
3241
|
+
try {
|
|
3242
|
+
const apiUrl = resolveTalkenApiUrl(config.talkenApiUrl);
|
|
3243
|
+
const res = await fetch(`${apiUrl}/wallet/mpc`, {
|
|
3244
|
+
method: "POST",
|
|
3245
|
+
headers: {
|
|
3246
|
+
"Content-Type": "application/json",
|
|
3247
|
+
"X-Access-Key": config.accessKey
|
|
3248
|
+
},
|
|
3249
|
+
body: JSON.stringify({ action: "info" })
|
|
3250
|
+
});
|
|
3251
|
+
const data = await res.json();
|
|
3252
|
+
const acct = data?.data?.accounts?.[0] || data?.data;
|
|
3253
|
+
if (acct?.ethAddress || acct?.address) {
|
|
3254
|
+
w = {
|
|
3255
|
+
address: acct.ethAddress || acct.address || w.address,
|
|
3256
|
+
chainId: w.chainId || config.defaultChainId || 1,
|
|
3257
|
+
uid: acct.uid || data?.data?.uid || "",
|
|
3258
|
+
sessionId: acct.sid || acct.sessionId || "",
|
|
3259
|
+
keyId: acct.keyId || (acct.wid != null ? String(acct.wid) : "") || (data?.data?.wid != null ? String(data.data.wid) : ""),
|
|
3260
|
+
encryptedShare: acct.encryptedShare || acct.pvencstr || "",
|
|
3261
|
+
sid: acct.sid || "",
|
|
3262
|
+
type: "evm",
|
|
3263
|
+
email: authState.user?.email || acct.email || data?.data?.email || ""
|
|
3264
|
+
};
|
|
3265
|
+
saveAuthState({ ...authState, wallet: w });
|
|
3266
|
+
}
|
|
3267
|
+
} catch (_) {
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
const fullWallet = {
|
|
3271
|
+
address: w.address,
|
|
3272
|
+
chainId: w.chainId || config.defaultChainId || 1,
|
|
3273
|
+
uid: w.uid || "",
|
|
3274
|
+
sessionId: w.sessionId || "",
|
|
3275
|
+
keyId: w.keyId || "",
|
|
3276
|
+
encryptedShare: w.encryptedShare || "",
|
|
3277
|
+
sid: w.sid || "",
|
|
3278
|
+
type: "evm",
|
|
3279
|
+
email: w.email || authState.user?.email || ""
|
|
3280
|
+
};
|
|
3281
|
+
provider.setWallet(fullWallet);
|
|
3282
|
+
} else {
|
|
3283
|
+
provider.setWallet(authState.wallet);
|
|
3284
|
+
if (authState.accessToken && authState.refreshToken && authState.expiresAt) {
|
|
3285
|
+
talkenApi.setTokens(
|
|
3286
|
+
authState.accessToken,
|
|
3287
|
+
authState.refreshToken,
|
|
3288
|
+
authState.expiresAt
|
|
3289
|
+
);
|
|
3290
|
+
}
|
|
2959
3291
|
}
|
|
2960
3292
|
const accounts = await provider.request({
|
|
2961
3293
|
method: "eth_requestAccounts"
|
|
@@ -3076,8 +3408,12 @@ function abcConnector(options) {
|
|
|
3076
3408
|
*/
|
|
3077
3409
|
async isAuthorized() {
|
|
3078
3410
|
try {
|
|
3079
|
-
if (isAccessKeyMode
|
|
3080
|
-
|
|
3411
|
+
if (isAccessKeyMode) {
|
|
3412
|
+
if (provider.isConnected())
|
|
3413
|
+
return true;
|
|
3414
|
+
const hasKey = !!config.accessKey || typeof localStorage !== "undefined" && !!localStorage.getItem("talken_ak");
|
|
3415
|
+
const authState2 = loadAuthState();
|
|
3416
|
+
return hasKey && !!authState2?.wallet?.address;
|
|
3081
3417
|
}
|
|
3082
3418
|
const authState = loadAuthState();
|
|
3083
3419
|
if (!authState || !authState.isAuthenticated) {
|
|
@@ -4587,7 +4923,11 @@ function createAbcBitcoinConnector(config) {
|
|
|
4587
4923
|
}
|
|
4588
4924
|
|
|
4589
4925
|
// src/wallets/walletConnectors/abcWallet/abcSolanaProvider.ts
|
|
4590
|
-
import {
|
|
4926
|
+
import {
|
|
4927
|
+
getShowPendingTransaction as getShowPendingTransaction2,
|
|
4928
|
+
getTalkenApiClient as getTalkenApiClient12,
|
|
4929
|
+
getUpdateTransactionResult as getUpdateTransactionResult2
|
|
4930
|
+
} from "@talken/talkenkit";
|
|
4591
4931
|
|
|
4592
4932
|
// src/utils/apiClientFactory.ts
|
|
4593
4933
|
function createWalletscanApi() {
|
|
@@ -4923,6 +5263,15 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
4923
5263
|
});
|
|
4924
5264
|
const api = this.getTalkenApiClientOrThrow();
|
|
4925
5265
|
const apiNetwork = this.wallet.network === "solana" ? "solana" : "solana_devnet";
|
|
5266
|
+
const showPending = getShowPendingTransaction2();
|
|
5267
|
+
if (showPending) {
|
|
5268
|
+
showPending({
|
|
5269
|
+
txHash: "",
|
|
5270
|
+
network: apiNetwork,
|
|
5271
|
+
chain: "solana",
|
|
5272
|
+
explorerUrl: void 0
|
|
5273
|
+
});
|
|
5274
|
+
}
|
|
4926
5275
|
if (params.mintAddress) {
|
|
4927
5276
|
const walletscanApi = createWalletscanApi();
|
|
4928
5277
|
const tokenMeta = await walletscanApi.getContractTokenWithTimeout({
|
|
@@ -4938,9 +5287,11 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
4938
5287
|
amount: String(rawAmount),
|
|
4939
5288
|
decimals,
|
|
4940
5289
|
network: apiNetwork,
|
|
4941
|
-
pin: pinHash
|
|
5290
|
+
pin: pinHash,
|
|
5291
|
+
waitForConfirmation: true
|
|
4942
5292
|
});
|
|
4943
5293
|
console.log("[AbcSolanaProvider] SPL transfer result:", result2);
|
|
5294
|
+
this.updateTransactionResult(result2, apiNetwork);
|
|
4944
5295
|
return { signature: result2.txHash };
|
|
4945
5296
|
}
|
|
4946
5297
|
const { LAMPORTS_PER_SOL } = await import("@solana/web3.js");
|
|
@@ -4955,9 +5306,11 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
4955
5306
|
toAddress: params.toAddress,
|
|
4956
5307
|
amountLamports: String(amountLamports),
|
|
4957
5308
|
network: apiNetwork,
|
|
4958
|
-
pin: pinHash
|
|
5309
|
+
pin: pinHash,
|
|
5310
|
+
waitForConfirmation: true
|
|
4959
5311
|
});
|
|
4960
5312
|
console.log("[AbcSolanaProvider] native transfer result:", result);
|
|
5313
|
+
this.updateTransactionResult(result, apiNetwork);
|
|
4961
5314
|
return { signature: result.txHash };
|
|
4962
5315
|
} catch (error) {
|
|
4963
5316
|
console.error("[AbcSolanaProvider] transfer FAILED:", {
|
|
@@ -5030,10 +5383,38 @@ var AbcSolanaProvider = class extends EventEmitter4 {
|
|
|
5030
5383
|
);
|
|
5031
5384
|
}
|
|
5032
5385
|
}
|
|
5386
|
+
updateTransactionResult(result, network) {
|
|
5387
|
+
const updateResult = getUpdateTransactionResult2();
|
|
5388
|
+
if (!updateResult)
|
|
5389
|
+
return;
|
|
5390
|
+
let receipt = result.receipt;
|
|
5391
|
+
if (!receipt && result.confirmation) {
|
|
5392
|
+
const data = result.confirmation?.data?.result ?? result.confirmation?.result ?? result.confirmation;
|
|
5393
|
+
const slot = data?.slot;
|
|
5394
|
+
const meta = data?.meta;
|
|
5395
|
+
receipt = {
|
|
5396
|
+
status: meta?.err === null ? 1 : 0,
|
|
5397
|
+
blockNumber: slot ?? null,
|
|
5398
|
+
gasUsed: meta?.fee != null ? String(meta.fee) : null
|
|
5399
|
+
};
|
|
5400
|
+
}
|
|
5401
|
+
const cluster = network.includes("devnet") ? "?cluster=devnet" : "";
|
|
5402
|
+
updateResult({
|
|
5403
|
+
txHash: result.txHash,
|
|
5404
|
+
network,
|
|
5405
|
+
chain: "solana",
|
|
5406
|
+
receipt,
|
|
5407
|
+
explorerUrl: `https://explorer.solana.com/tx/${result.txHash}${cluster}`
|
|
5408
|
+
});
|
|
5409
|
+
}
|
|
5033
5410
|
};
|
|
5034
5411
|
|
|
5035
5412
|
// src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
|
|
5036
|
-
import {
|
|
5413
|
+
import {
|
|
5414
|
+
getShowPendingTransaction as getShowPendingTransaction3,
|
|
5415
|
+
getTalkenApiClient as getTalkenApiClient13,
|
|
5416
|
+
getUpdateTransactionResult as getUpdateTransactionResult3
|
|
5417
|
+
} from "@talken/talkenkit";
|
|
5037
5418
|
import { keccak256 } from "viem";
|
|
5038
5419
|
function isTalkenApiClient2(client) {
|
|
5039
5420
|
return typeof client?.tron?.transferTrx === "function";
|
|
@@ -5354,6 +5735,7 @@ ${msgBytes.length}`
|
|
|
5354
5735
|
toAddress: params.toAddress,
|
|
5355
5736
|
amountSun: amountRaw,
|
|
5356
5737
|
pin: pinHash,
|
|
5738
|
+
waitForConfirmation: true,
|
|
5357
5739
|
...email && { email }
|
|
5358
5740
|
} : {
|
|
5359
5741
|
kind: "trc20",
|
|
@@ -5363,10 +5745,21 @@ ${msgBytes.length}`
|
|
|
5363
5745
|
amount: amountRaw,
|
|
5364
5746
|
feeLimit: params.feeLimit,
|
|
5365
5747
|
pin: pinHash,
|
|
5748
|
+
waitForConfirmation: true,
|
|
5366
5749
|
...email && { email }
|
|
5367
5750
|
};
|
|
5751
|
+
const showPending = getShowPendingTransaction3();
|
|
5752
|
+
if (showPending) {
|
|
5753
|
+
showPending({
|
|
5754
|
+
txHash: "",
|
|
5755
|
+
network: this.network.type,
|
|
5756
|
+
chain: "tron",
|
|
5757
|
+
explorerUrl: void 0
|
|
5758
|
+
});
|
|
5759
|
+
}
|
|
5368
5760
|
const result = await api.tron.transferTrx(request);
|
|
5369
5761
|
const txHash = result.txHash;
|
|
5762
|
+
this.updateTransactionResult(result);
|
|
5370
5763
|
console.log(
|
|
5371
5764
|
`[TronProvider] \u2705 ${txType === "NATIVE" ? "TRX" : "TRC-20"} transaction complete via TalkenApiClient:`,
|
|
5372
5765
|
txHash
|
|
@@ -5413,6 +5806,33 @@ ${msgBytes.length}`
|
|
|
5413
5806
|
network: this.network.type
|
|
5414
5807
|
};
|
|
5415
5808
|
}
|
|
5809
|
+
updateTransactionResult(result) {
|
|
5810
|
+
const updateResult = getUpdateTransactionResult3();
|
|
5811
|
+
if (!updateResult)
|
|
5812
|
+
return;
|
|
5813
|
+
let receipt = result.receipt;
|
|
5814
|
+
if (!receipt && result.confirmation) {
|
|
5815
|
+
const conf = result.confirmation;
|
|
5816
|
+
const info = conf?.info ?? conf;
|
|
5817
|
+
const tx = conf?.transaction ?? conf;
|
|
5818
|
+
const blockNumber = info?.blockNumber ?? info?.result?.blockNumber ?? null;
|
|
5819
|
+
const rcpt = info?.receipt ?? info?.result?.receipt;
|
|
5820
|
+
const ret = tx?.ret ?? tx?.result?.ret;
|
|
5821
|
+
const contractRet = Array.isArray(ret) ? ret[0]?.contractRet : void 0;
|
|
5822
|
+
receipt = {
|
|
5823
|
+
status: contractRet === "SUCCESS" ? 1 : contractRet ? 0 : null,
|
|
5824
|
+
blockNumber,
|
|
5825
|
+
gasUsed: rcpt?.energy_usage_total != null ? String(rcpt.energy_usage_total) : null
|
|
5826
|
+
};
|
|
5827
|
+
}
|
|
5828
|
+
updateResult({
|
|
5829
|
+
txHash: result.txHash,
|
|
5830
|
+
network: this.network.type,
|
|
5831
|
+
chain: "tron",
|
|
5832
|
+
receipt,
|
|
5833
|
+
explorerUrl: `${this.network.explorer}/#/transaction/${result.txHash}`
|
|
5834
|
+
});
|
|
5835
|
+
}
|
|
5416
5836
|
};
|
|
5417
5837
|
|
|
5418
5838
|
// src/wallets/walletConnectors/abcWallet/walletGeneration.ts
|