@kimafinance/kima-transaction-widget 1.2.42 → 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 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
- var _exit = false;
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 _temp3 = _catch(function () {
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 (error) {
2589
- var err = error;
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);
@@ -12945,10 +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
- console.log(chainData);
12949
- toast.toast.error('Please switch to Tron Nile Testnet!');
12950
- if (chainData.chainId !== '0xcd8690dc') {
12951
- adapters[0].switchChain('0xcd8690dc');
12874
+ toast.toast.error('Please switch to Tron Mainnet!');
12875
+ if (chainData.chainId !== '0x2b6653dc') {
12876
+ adapters[0].switchChain('0x2b6653dc');
12952
12877
  }
12953
12878
  };
12954
12879
  react.createWeb3Modal({