@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.
@@ -483,21 +483,24 @@ const CHAIN_NAMES_TO_STRING = {
483
483
  [ChainName.POLYGON]: 'Polygon',
484
484
  [ChainName.AVALANCHE]: 'Avalanche',
485
485
  [ChainName.FUSE]: 'Fuse',
486
- [ChainName.CELO]: 'Celo'
486
+ [ChainName.CELO]: 'Celo',
487
+ [ChainName.SOLANA]: 'Solana'
487
488
  };
488
489
  const CHAIN_NAMES_TO_EXPLORER = {
489
490
  [ChainName.ETHEREUM]: 'goerli.etherscan.io',
490
491
  [ChainName.POLYGON]: 'mumbai.polygonscan.com',
491
492
  [ChainName.AVALANCHE]: 'testnet.snowtrace.io',
492
493
  [ChainName.FUSE]: 'explorer.fuse.io',
493
- [ChainName.CELO]: 'explorer.celo.org'
494
+ [ChainName.CELO]: 'explorer.celo.org',
495
+ [ChainName.SOLANA]: 'solscan.io'
494
496
  };
495
497
  const CHAIN_NAMES_TO_GECKO_ID = {
496
498
  [ChainName.ETHEREUM]: 'ethereum',
497
499
  [ChainName.POLYGON]: 'matic-network',
498
500
  [ChainName.AVALANCHE]: 'avalanche-2',
499
501
  [ChainName.FUSE]: 'fuse-network-token',
500
- [ChainName.CELO]: 'celo'
502
+ [ChainName.CELO]: 'celo',
503
+ [ChainName.SOLANA]: 'solana'
501
504
  };
502
505
  const CHAIN_IDS_TO_NAMES = {
503
506
  [SupportedChainId.ETHEREUM]: ChainName.ETHEREUM,
@@ -550,7 +553,7 @@ const COIN_LIST = {
550
553
  POL: POLYGON_USDK_ADDRESS,
551
554
  AVX: AVAX_USDK_ADDRESS
552
555
  },
553
- decimals: 18
556
+ decimals: 6
554
557
  },
555
558
  GDOLLAR: {
556
559
  symbol: 'G$',
@@ -6211,12 +6214,12 @@ function useAllowance() {
6211
6214
  if ((result === null || result === void 0 ? void 0 : (_result$tssPubkey = result.tssPubkey) === null || _result$tssPubkey === void 0 ? void 0 : _result$tssPubkey.length) < 1) {
6212
6215
  return;
6213
6216
  }
6214
- setTargetAddress(result.tssPubkey[0].ecdsa);
6217
+ setTargetAddress(sourceChain === ChainName.SOLANA ? result.tssPubkey[0].ebdsa : result.tssPubkey[0].ecdsa);
6215
6218
  };
6216
6219
  useEffect(() => {
6217
6220
  if (!nodeProviderQuery) return;
6218
6221
  updatePoolAddress();
6219
- }, [nodeProviderQuery]);
6222
+ }, [nodeProviderQuery, sourceChain]);
6220
6223
  useEffect(() => {
6221
6224
  (async () => {
6222
6225
  try {
@@ -6252,8 +6255,7 @@ function useAllowance() {
6252
6255
  const mint = new PublicKey(tokenAddress);
6253
6256
  const toPublicKey = new PublicKey(targetAddress);
6254
6257
  const fromTokenAccount = await getOrCreateAssociatedTokenAccount(connection, publicKey, mint, publicKey, signTransaction);
6255
- const toTokenAccount = await getOrCreateAssociatedTokenAccount(connection, publicKey, mint, toPublicKey, signTransaction);
6256
- const transaction = new Transaction().add(createApproveTransferInstruction(fromTokenAccount.address, toTokenAccount.address, publicKey, (amount + serviceFee) * Math.pow(10, COIN_LIST['USDK'].decimals), [], TOKEN_PROGRAM_ID));
6258
+ const transaction = new Transaction().add(createApproveTransferInstruction(fromTokenAccount.address, toPublicKey, publicKey, (amount + serviceFee) * Math.pow(10, COIN_LIST['USDK'].decimals), [], TOKEN_PROGRAM_ID));
6257
6259
  const blockHash = await connection.getLatestBlockhash();
6258
6260
  transaction.feePayer = publicKey;
6259
6261
  transaction.recentBlockhash = await blockHash.blockhash;