@kimafinance/kima-transaction-widget 1.2.41 → 1.2.43
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.js +36 -110
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +35 -87
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2462,49 +2462,6 @@ var ERC20ABI = {
|
|
|
2462
2462
|
abi: abi
|
|
2463
2463
|
};
|
|
2464
2464
|
|
|
2465
|
-
function createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId, associatedTokenProgramId) {
|
|
2466
|
-
if (programId === void 0) {
|
|
2467
|
-
programId = splToken.TOKEN_PROGRAM_ID;
|
|
2468
|
-
}
|
|
2469
|
-
if (associatedTokenProgramId === void 0) {
|
|
2470
|
-
associatedTokenProgramId = splToken.ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
2471
|
-
}
|
|
2472
|
-
var keys = [{
|
|
2473
|
-
pubkey: payer,
|
|
2474
|
-
isSigner: true,
|
|
2475
|
-
isWritable: true
|
|
2476
|
-
}, {
|
|
2477
|
-
pubkey: associatedToken,
|
|
2478
|
-
isSigner: false,
|
|
2479
|
-
isWritable: true
|
|
2480
|
-
}, {
|
|
2481
|
-
pubkey: owner,
|
|
2482
|
-
isSigner: false,
|
|
2483
|
-
isWritable: false
|
|
2484
|
-
}, {
|
|
2485
|
-
pubkey: mint,
|
|
2486
|
-
isSigner: false,
|
|
2487
|
-
isWritable: false
|
|
2488
|
-
}, {
|
|
2489
|
-
pubkey: web3_js.SystemProgram.programId,
|
|
2490
|
-
isSigner: false,
|
|
2491
|
-
isWritable: false
|
|
2492
|
-
}, {
|
|
2493
|
-
pubkey: programId,
|
|
2494
|
-
isSigner: false,
|
|
2495
|
-
isWritable: false
|
|
2496
|
-
}, {
|
|
2497
|
-
pubkey: web3_js.SYSVAR_RENT_PUBKEY,
|
|
2498
|
-
isSigner: false,
|
|
2499
|
-
isWritable: false
|
|
2500
|
-
}];
|
|
2501
|
-
return new web3_js.TransactionInstruction({
|
|
2502
|
-
keys: keys,
|
|
2503
|
-
programId: associatedTokenProgramId,
|
|
2504
|
-
data: Buffer.alloc(0)
|
|
2505
|
-
});
|
|
2506
|
-
}
|
|
2507
|
-
|
|
2508
2465
|
var getAccountInfo = function getAccountInfo(connection, address, commitment, programId) {
|
|
2509
2466
|
if (programId === void 0) {
|
|
2510
2467
|
programId = splToken.TOKEN_PROGRAM_ID;
|
|
@@ -2573,50 +2530,19 @@ var getOrCreateAssociatedTokenAccount = function getOrCreateAssociatedTokenAccou
|
|
|
2573
2530
|
}
|
|
2574
2531
|
try {
|
|
2575
2532
|
return Promise.resolve(getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve, programId, associatedTokenProgramId)).then(function (associatedToken) {
|
|
2576
|
-
|
|
2577
|
-
function _temp4(_result) {
|
|
2578
|
-
if (_exit) return _result;
|
|
2533
|
+
function _temp2() {
|
|
2579
2534
|
if (!account.mint.equals(mint)) throw Error('TokenInvalidMintError');
|
|
2580
2535
|
if (!account.owner.equals(owner)) throw new Error('TokenInvalidOwnerError');
|
|
2581
2536
|
return account;
|
|
2582
2537
|
}
|
|
2538
|
+
console.log(payer, signTransaction);
|
|
2583
2539
|
var account;
|
|
2584
|
-
var
|
|
2540
|
+
var _temp = _catch(function () {
|
|
2585
2541
|
return Promise.resolve(getAccountInfo(connection, associatedToken, commitment, programId)).then(function (_getAccountInfo) {
|
|
2586
2542
|
account = _getAccountInfo;
|
|
2587
2543
|
});
|
|
2588
|
-
}, function (
|
|
2589
|
-
|
|
2590
|
-
return function () {
|
|
2591
|
-
if (err.message === 'TokenAccountNotFoundError' || err.message === 'TokenInvalidAccountOwnerError') {
|
|
2592
|
-
var _temp2 = function _temp2() {
|
|
2593
|
-
return Promise.resolve(getAccountInfo(connection, associatedToken, commitment, programId)).then(function (_getAccountInfo2) {
|
|
2594
|
-
account = _getAccountInfo2;
|
|
2595
|
-
});
|
|
2596
|
-
};
|
|
2597
|
-
var _temp = _catch(function () {
|
|
2598
|
-
var transaction = new web3_js.Transaction().add(createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId, associatedTokenProgramId));
|
|
2599
|
-
return Promise.resolve(connection.getRecentBlockhash()).then(function (blockHash) {
|
|
2600
|
-
return Promise.resolve(payer).then(function (_payer) {
|
|
2601
|
-
transaction.feePayer = _payer;
|
|
2602
|
-
return Promise.resolve(blockHash.blockhash).then(function (_blockHash$blockhash) {
|
|
2603
|
-
transaction.recentBlockhash = _blockHash$blockhash;
|
|
2604
|
-
return Promise.resolve(signTransaction(transaction)).then(function (signed) {
|
|
2605
|
-
return Promise.resolve(connection.sendRawTransaction(signed.serialize())).then(function (signature) {
|
|
2606
|
-
return Promise.resolve(connection.confirmTransaction(signature)).then(function () {});
|
|
2607
|
-
});
|
|
2608
|
-
});
|
|
2609
|
-
});
|
|
2610
|
-
});
|
|
2611
|
-
});
|
|
2612
|
-
}, function () {});
|
|
2613
|
-
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
2614
|
-
} else {
|
|
2615
|
-
throw error;
|
|
2616
|
-
}
|
|
2617
|
-
}();
|
|
2618
|
-
});
|
|
2619
|
-
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
2544
|
+
}, function () {});
|
|
2545
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
2620
2546
|
});
|
|
2621
2547
|
} catch (e) {
|
|
2622
2548
|
return Promise.reject(e);
|
|
@@ -12870,53 +12796,53 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
12870
12796
|
var ConnectionProvider = SolanaAdapter.ConnectionProvider,
|
|
12871
12797
|
SolanaWalletProvider = SolanaAdapter.WalletProvider;
|
|
12872
12798
|
var ethereum = {
|
|
12873
|
-
chainId:
|
|
12874
|
-
name: 'Ethereum
|
|
12799
|
+
chainId: 1,
|
|
12800
|
+
name: 'Ethereum Mainnet',
|
|
12875
12801
|
currency: 'ETH',
|
|
12876
|
-
explorerUrl: 'https://
|
|
12877
|
-
rpcUrl: 'https://
|
|
12802
|
+
explorerUrl: 'https://etherscan.io',
|
|
12803
|
+
rpcUrl: 'https://eth.llamarpc.com'
|
|
12878
12804
|
};
|
|
12879
12805
|
var bsc = {
|
|
12880
|
-
chainId:
|
|
12881
|
-
name: 'BNB Smart Chain
|
|
12882
|
-
currency: '
|
|
12883
|
-
explorerUrl: 'https://
|
|
12884
|
-
rpcUrl: 'https://
|
|
12806
|
+
chainId: 56,
|
|
12807
|
+
name: 'BNB Smart Chain Mainnet',
|
|
12808
|
+
currency: 'BNB',
|
|
12809
|
+
explorerUrl: 'https://bscscan.com',
|
|
12810
|
+
rpcUrl: 'https://binance.llamarpc.com'
|
|
12885
12811
|
};
|
|
12886
12812
|
var polygon = {
|
|
12887
|
-
chainId:
|
|
12888
|
-
name: '
|
|
12813
|
+
chainId: 137,
|
|
12814
|
+
name: 'Polygon Mainnet',
|
|
12889
12815
|
currency: 'MATIC',
|
|
12890
|
-
explorerUrl: 'https://
|
|
12891
|
-
rpcUrl: 'https://
|
|
12816
|
+
explorerUrl: 'https://polygonscan.com',
|
|
12817
|
+
rpcUrl: 'https://polygon.llamarpc.com'
|
|
12892
12818
|
};
|
|
12893
12819
|
var arbitrum = {
|
|
12894
|
-
chainId:
|
|
12895
|
-
name: 'Arbitrum
|
|
12820
|
+
chainId: 42161,
|
|
12821
|
+
name: 'Arbitrum Mainnet',
|
|
12896
12822
|
currency: 'ETH',
|
|
12897
|
-
explorerUrl: 'https://
|
|
12898
|
-
rpcUrl: 'https://
|
|
12823
|
+
explorerUrl: 'https://arbiscan.io',
|
|
12824
|
+
rpcUrl: 'https://arbitrum.llamarpc.com'
|
|
12899
12825
|
};
|
|
12900
12826
|
var optimism = {
|
|
12901
|
-
chainId:
|
|
12902
|
-
name: 'OP
|
|
12827
|
+
chainId: 10,
|
|
12828
|
+
name: 'OP Mainnet',
|
|
12903
12829
|
currency: 'ETH',
|
|
12904
|
-
explorerUrl: 'https://
|
|
12905
|
-
rpcUrl: 'https://
|
|
12830
|
+
explorerUrl: 'https://optimistic.etherscan.io',
|
|
12831
|
+
rpcUrl: 'https://optimism.llamarpc.com'
|
|
12906
12832
|
};
|
|
12907
12833
|
var avalanche = {
|
|
12908
|
-
chainId:
|
|
12909
|
-
name: 'Avalanche
|
|
12834
|
+
chainId: 43114,
|
|
12835
|
+
name: 'Avalanche Mainnet',
|
|
12910
12836
|
currency: 'AVAX',
|
|
12911
|
-
explorerUrl: 'https://
|
|
12912
|
-
rpcUrl: 'https://api.avax
|
|
12837
|
+
explorerUrl: 'https://snowtrace.io',
|
|
12838
|
+
rpcUrl: 'https://api.avax.network/ext/bc/C/rpc'
|
|
12913
12839
|
};
|
|
12914
12840
|
var zkEVM = {
|
|
12915
|
-
chainId:
|
|
12841
|
+
chainId: 1101,
|
|
12916
12842
|
name: 'Polygon zkEVM Cardona Testnet',
|
|
12917
12843
|
currency: 'ETH',
|
|
12918
|
-
explorerUrl: 'https://
|
|
12919
|
-
rpcUrl: 'https://
|
|
12844
|
+
explorerUrl: 'https://zkevm.polygonscan.com',
|
|
12845
|
+
rpcUrl: 'https://rpc.ankr.com/polygon_zkevm'
|
|
12920
12846
|
};
|
|
12921
12847
|
var metadata = {
|
|
12922
12848
|
name: 'Kima Transaction Widget',
|
|
@@ -12945,9 +12871,9 @@ var KimaProvider = function KimaProvider(_ref) {
|
|
|
12945
12871
|
} else toast.toast.error(e.message);
|
|
12946
12872
|
}
|
|
12947
12873
|
var onChainChanged = function onChainChanged(chainData) {
|
|
12948
|
-
toast.toast.error('Please switch to Tron
|
|
12949
|
-
if (chainData.chainId !== '
|
|
12950
|
-
adapters[0].switchChain('
|
|
12874
|
+
toast.toast.error('Please switch to Tron Mainnet!');
|
|
12875
|
+
if (chainData.chainId !== '0x2b6653dc') {
|
|
12876
|
+
adapters[0].switchChain('0x2b6653dc');
|
|
12951
12877
|
}
|
|
12952
12878
|
};
|
|
12953
12879
|
react.createWeb3Modal({
|