@kimafinance/kima-transaction-widget 1.0.6 → 1.0.8

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
@@ -570,9 +570,9 @@ var SupportedChainId;
570
570
  SupportedChainId[SupportedChainId["CELO"] = 42220] = "CELO";
571
571
  })(SupportedChainId || (SupportedChainId = {}));
572
572
  var CHAIN_NAMES_TO_IDS = (_CHAIN_NAMES_TO_IDS = {}, _CHAIN_NAMES_TO_IDS[exports.SupportNetworks.ETHEREUM] = SupportedChainId.ETHEREUM, _CHAIN_NAMES_TO_IDS[exports.SupportNetworks.POLYGON] = SupportedChainId.POLYGON, _CHAIN_NAMES_TO_IDS[exports.SupportNetworks.AVALANCHE] = SupportedChainId.AVALANCHE, _CHAIN_NAMES_TO_IDS[exports.SupportNetworks.FUSE] = SupportedChainId.FUSE, _CHAIN_NAMES_TO_IDS[exports.SupportNetworks.CELO] = SupportedChainId.CELO, _CHAIN_NAMES_TO_IDS);
573
- var CHAIN_NAMES_TO_STRING = (_CHAIN_NAMES_TO_STRIN = {}, _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.ETHEREUM] = 'Ethereum', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.POLYGON] = 'Polygon', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.AVALANCHE] = 'Avalanche', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.FUSE] = 'Fuse', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.CELO] = 'Celo', _CHAIN_NAMES_TO_STRIN);
574
- var CHAIN_NAMES_TO_EXPLORER = (_CHAIN_NAMES_TO_EXPLO = {}, _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.ETHEREUM] = 'goerli.etherscan.io', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.POLYGON] = 'mumbai.polygonscan.com', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.AVALANCHE] = 'testnet.snowtrace.io', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.FUSE] = 'explorer.fuse.io', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.CELO] = 'explorer.celo.org', _CHAIN_NAMES_TO_EXPLO);
575
- var CHAIN_NAMES_TO_GECKO_ID = (_CHAIN_NAMES_TO_GECKO = {}, _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.ETHEREUM] = 'ethereum', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.POLYGON] = 'matic-network', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.AVALANCHE] = 'avalanche-2', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.FUSE] = 'fuse-network-token', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.CELO] = 'celo', _CHAIN_NAMES_TO_GECKO);
573
+ var CHAIN_NAMES_TO_STRING = (_CHAIN_NAMES_TO_STRIN = {}, _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.ETHEREUM] = 'Ethereum', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.POLYGON] = 'Polygon', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.AVALANCHE] = 'Avalanche', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.FUSE] = 'Fuse', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.CELO] = 'Celo', _CHAIN_NAMES_TO_STRIN[exports.SupportNetworks.SOLANA] = 'Solana', _CHAIN_NAMES_TO_STRIN);
574
+ var CHAIN_NAMES_TO_EXPLORER = (_CHAIN_NAMES_TO_EXPLO = {}, _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.ETHEREUM] = 'goerli.etherscan.io', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.POLYGON] = 'mumbai.polygonscan.com', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.AVALANCHE] = 'testnet.snowtrace.io', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.FUSE] = 'explorer.fuse.io', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.CELO] = 'explorer.celo.org', _CHAIN_NAMES_TO_EXPLO[exports.SupportNetworks.SOLANA] = 'solscan.io', _CHAIN_NAMES_TO_EXPLO);
575
+ var CHAIN_NAMES_TO_GECKO_ID = (_CHAIN_NAMES_TO_GECKO = {}, _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.ETHEREUM] = 'ethereum', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.POLYGON] = 'matic-network', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.AVALANCHE] = 'avalanche-2', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.FUSE] = 'fuse-network-token', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.CELO] = 'celo', _CHAIN_NAMES_TO_GECKO[exports.SupportNetworks.SOLANA] = 'solana', _CHAIN_NAMES_TO_GECKO);
576
576
  var CHAIN_IDS_TO_NAMES = (_CHAIN_IDS_TO_NAMES = {}, _CHAIN_IDS_TO_NAMES[SupportedChainId.ETHEREUM] = exports.SupportNetworks.ETHEREUM, _CHAIN_IDS_TO_NAMES[SupportedChainId.POLYGON] = exports.SupportNetworks.POLYGON, _CHAIN_IDS_TO_NAMES[SupportedChainId.AVALANCHE] = exports.SupportNetworks.AVALANCHE, _CHAIN_IDS_TO_NAMES[SupportedChainId.FUSE] = exports.SupportNetworks.FUSE, _CHAIN_IDS_TO_NAMES[SupportedChainId.CELO] = exports.SupportNetworks.CELO, _CHAIN_IDS_TO_NAMES);
577
577
  var networkOptions = [{
578
578
  id: exports.SupportNetworks.ETHEREUM,
@@ -622,7 +622,7 @@ var COIN_LIST = {
622
622
  POL: POLYGON_USDK_ADDRESS,
623
623
  AVX: AVAX_USDK_ADDRESS
624
624
  },
625
- decimals: 18
625
+ decimals: 6
626
626
  },
627
627
  GDOLLAR: {
628
628
  symbol: 'G$',
@@ -6561,7 +6561,7 @@ function useAllowance() {
6561
6561
  if ((result === null || result === void 0 ? void 0 : (_result$tssPubkey = result.tssPubkey) === null || _result$tssPubkey === void 0 ? void 0 : _result$tssPubkey.length) < 1) {
6562
6562
  return;
6563
6563
  }
6564
- setTargetAddress(result.tssPubkey[0].ecdsa);
6564
+ setTargetAddress(sourceChain === exports.SupportNetworks.SOLANA ? result.tssPubkey[0].ebdsa : result.tssPubkey[0].ecdsa);
6565
6565
  });
6566
6566
  } catch (e) {
6567
6567
  return Promise.reject(e);
@@ -6570,7 +6570,7 @@ function useAllowance() {
6570
6570
  React.useEffect(function () {
6571
6571
  if (!nodeProviderQuery) return;
6572
6572
  updatePoolAddress();
6573
- }, [nodeProviderQuery]);
6573
+ }, [nodeProviderQuery, sourceChain]);
6574
6574
  React.useEffect(function () {
6575
6575
  (function () {
6576
6576
  try {
@@ -6601,17 +6601,15 @@ function useAllowance() {
6601
6601
  var mint = new web3_js.PublicKey(tokenAddress);
6602
6602
  var toPublicKey = new web3_js.PublicKey(targetAddress);
6603
6603
  return Promise.resolve(getOrCreateAssociatedTokenAccount(connection, publicKey, mint, publicKey, signTransaction)).then(function (fromTokenAccount) {
6604
- return Promise.resolve(getOrCreateAssociatedTokenAccount(connection, publicKey, mint, toPublicKey, signTransaction)).then(function (toTokenAccount) {
6605
- var transaction = new web3_js.Transaction().add(createApproveTransferInstruction(fromTokenAccount.address, toTokenAccount.address, publicKey, (amount + serviceFee) * Math.pow(10, COIN_LIST['USDK'].decimals), [], splToken.TOKEN_PROGRAM_ID));
6606
- return Promise.resolve(connection.getLatestBlockhash()).then(function (blockHash) {
6607
- transaction.feePayer = publicKey;
6608
- return Promise.resolve(blockHash.blockhash).then(function (_blockHash$blockhash) {
6609
- transaction.recentBlockhash = _blockHash$blockhash;
6610
- return Promise.resolve(signTransaction(transaction)).then(function (signed) {
6611
- return Promise.resolve(connection.sendRawTransaction(signed.serialize())).then(function () {
6612
- dispatch(setSplAllowance(amount + serviceFee));
6613
- dispatch(setApproving(false));
6614
- });
6604
+ var transaction = new web3_js.Transaction().add(createApproveTransferInstruction(fromTokenAccount.address, toPublicKey, publicKey, (amount + serviceFee) * Math.pow(10, COIN_LIST['USDK'].decimals), [], splToken.TOKEN_PROGRAM_ID));
6605
+ return Promise.resolve(connection.getLatestBlockhash()).then(function (blockHash) {
6606
+ transaction.feePayer = publicKey;
6607
+ return Promise.resolve(blockHash.blockhash).then(function (_blockHash$blockhash) {
6608
+ transaction.recentBlockhash = _blockHash$blockhash;
6609
+ return Promise.resolve(signTransaction(transaction)).then(function (signed) {
6610
+ return Promise.resolve(connection.sendRawTransaction(signed.serialize())).then(function () {
6611
+ dispatch(setSplAllowance(amount + serviceFee));
6612
+ dispatch(setApproving(false));
6615
6613
  });
6616
6614
  });
6617
6615
  });