coinley-checkout 1.2.1 → 1.2.3
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/coinley-checkout.es.js +81 -108
- package/dist/coinley-checkout.es.js.map +1 -1
- package/dist/coinley-checkout.umd.js +10 -10
- package/dist/coinley-checkout.umd.js.map +1 -1
- package/dist/{index-e49d97f5.mjs → index-99d8107e.mjs} +294 -227
- package/dist/index-99d8107e.mjs.map +1 -0
- package/package.json +3 -2
- package/dist/index-e49d97f5.mjs.map +0 -1
|
@@ -34,7 +34,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
34
34
|
__accessCheck(obj, member, "access private method");
|
|
35
35
|
return method;
|
|
36
36
|
};
|
|
37
|
-
var _listener, _listeners, _cancelled, _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn, _statusCode, _statusMessage, _headers2, _body2, _request, _error, _format, _val, _tens, _checkFormat, checkFormat_fn, _checkValue, checkValue_fn, _add, add_fn, _sub, sub_fn, _mul, mul_fn, _div, div_fn, _names, _data, _dataLength, _writeData, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn, _r, _s, _v, _networkV, _privateKey, _options, _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes, _kzg, _blobs, _auths, _getSerialized, getSerialized_fn, _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn, _offset2, _tokens, _subTokenString, subTokenString_fn, _walkAsync, walkAsync_fn, _getCoder, getCoder_fn, _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn, _transactions, _logs, _startBlock, _iface, _iface2, _filter,
|
|
37
|
+
var _listener, _listeners, _cancelled, _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn, _statusCode, _statusMessage, _headers2, _body2, _request, _error, _format, _val, _tens, _checkFormat, checkFormat_fn, _checkValue, checkValue_fn, _add, add_fn, _sub, sub_fn, _mul, mul_fn, _div, div_fn, _names, _data, _dataLength, _writeData, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn, _r, _s, _v, _networkV, _privateKey, _options, _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes, _kzg, _blobs, _auths, _getSerialized, getSerialized_fn, _a, _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn, _offset2, _tokens, _subTokenString, subTokenString_fn, _walkAsync, walkAsync_fn, _getCoder, getCoder_fn, _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn, _transactions, _logs, _startBlock, _iface, _iface2, _filter, _b, _supports2544, _resolver, _fetch, fetch_fn, _getResolver, getResolver_fn, _url2, _processFunc, _name, _chainId2, _plugins, _provider, _poller, _interval, _blockNumber, _poll, poll_fn, _provider2, _poll2, _running, _tag, _lastBlock, _filter2, _hash, _provider3, _filter3, _poller2, _running2, _blockNumber2, _poll3, poll_fn2, _subs, _plugins2, _pausedState, _destroyed, _networkPromise, _anyNetwork, _performCache, _lastBlockNumber, _nextTimer, _timers, _disableCcipRead, _options2, _perform, perform_fn, _call, call_fn, _checkNetwork, checkNetwork_fn, _getAccountValue, getAccountValue_fn, _getBlock, getBlock_fn, _hasSub, hasSub_fn, _getSub, getSub_fn, _provider4, _filterIdPromise, _poller3, _running3, _network, _hault, _poll4, poll_fn3, _teardown, teardown_fn, _event, _options3, _nextId, _payloads, _drainTimer, _notReady, _network2, _pendingDetectNetwork, _scheduleDrain, scheduleDrain_fn, _pollingInterval, _request2, _providerInfo;
|
|
38
38
|
import React, { createContext, useContext, useState, useEffect, useRef, forwardRef, useImperativeHandle } from "react";
|
|
39
39
|
const styles = "";
|
|
40
40
|
const version = "6.14.3";
|
|
@@ -1284,7 +1284,7 @@ _throttle = new WeakMap();
|
|
|
1284
1284
|
_getUrlFunc = new WeakMap();
|
|
1285
1285
|
_send = new WeakSet();
|
|
1286
1286
|
send_fn = async function(attempt, expires, delay, _request3, _response) {
|
|
1287
|
-
var _a2,
|
|
1287
|
+
var _a2, _b2, _c;
|
|
1288
1288
|
if (attempt >= __privateGet(this, _throttle).maxAttempts) {
|
|
1289
1289
|
return _response.makeServerError("exceeded maximum retry limit");
|
|
1290
1290
|
}
|
|
@@ -1335,7 +1335,7 @@ send_fn = async function(attempt, expires, delay, _request3, _response) {
|
|
|
1335
1335
|
if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) {
|
|
1336
1336
|
delay2 = parseInt(retryAfter);
|
|
1337
1337
|
}
|
|
1338
|
-
return __privateMethod(
|
|
1338
|
+
return __privateMethod(_b2 = req.clone(), _send, send_fn).call(_b2, attempt + 1, expires, delay2, _request3, response);
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
1341
|
if (this.processFunc) {
|
|
@@ -2628,6 +2628,7 @@ peekBytes_fn = function(offset, length, loose) {
|
|
|
2628
2628
|
return __privateGet(this, _data2).slice(__privateGet(this, _offset), __privateGet(this, _offset) + alignedLength);
|
|
2629
2629
|
};
|
|
2630
2630
|
let Reader = _Reader;
|
|
2631
|
+
const global = globalThis || void 0 || self;
|
|
2631
2632
|
function number(n2) {
|
|
2632
2633
|
if (!Number.isSafeInteger(n2) || n2 < 0)
|
|
2633
2634
|
throw new Error(`Wrong positive integer: ${n2}`);
|
|
@@ -7157,7 +7158,7 @@ function _serializeEip7702(tx, sig) {
|
|
|
7157
7158
|
}
|
|
7158
7159
|
return concat(["0x04", encodeRlp(fields)]);
|
|
7159
7160
|
}
|
|
7160
|
-
|
|
7161
|
+
let Transaction$1 = (_a = class {
|
|
7161
7162
|
/**
|
|
7162
7163
|
* Creates a new Transaction with default values.
|
|
7163
7164
|
*/
|
|
@@ -7686,7 +7687,7 @@ const _Transaction = class _Transaction {
|
|
|
7686
7687
|
* Create a copy of this transaciton.
|
|
7687
7688
|
*/
|
|
7688
7689
|
clone() {
|
|
7689
|
-
return
|
|
7690
|
+
return _a.from(this);
|
|
7690
7691
|
}
|
|
7691
7692
|
/**
|
|
7692
7693
|
* Return a JSON-friendly object.
|
|
@@ -7720,26 +7721,26 @@ const _Transaction = class _Transaction {
|
|
|
7720
7721
|
*/
|
|
7721
7722
|
static from(tx) {
|
|
7722
7723
|
if (tx == null) {
|
|
7723
|
-
return new
|
|
7724
|
+
return new _a();
|
|
7724
7725
|
}
|
|
7725
7726
|
if (typeof tx === "string") {
|
|
7726
7727
|
const payload = getBytes(tx);
|
|
7727
7728
|
if (payload[0] >= 127) {
|
|
7728
|
-
return
|
|
7729
|
+
return _a.from(_parseLegacy(payload));
|
|
7729
7730
|
}
|
|
7730
7731
|
switch (payload[0]) {
|
|
7731
7732
|
case 1:
|
|
7732
|
-
return
|
|
7733
|
+
return _a.from(_parseEip2930(payload));
|
|
7733
7734
|
case 2:
|
|
7734
|
-
return
|
|
7735
|
+
return _a.from(_parseEip1559(payload));
|
|
7735
7736
|
case 3:
|
|
7736
|
-
return
|
|
7737
|
+
return _a.from(_parseEip4844(payload));
|
|
7737
7738
|
case 4:
|
|
7738
|
-
return
|
|
7739
|
+
return _a.from(_parseEip7702(payload));
|
|
7739
7740
|
}
|
|
7740
7741
|
assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" });
|
|
7741
7742
|
}
|
|
7742
|
-
const result = new
|
|
7743
|
+
const result = new _a();
|
|
7743
7744
|
if (tx.type != null) {
|
|
7744
7745
|
result.type = tx.type;
|
|
7745
7746
|
}
|
|
@@ -7801,26 +7802,7 @@ const _Transaction = class _Transaction {
|
|
|
7801
7802
|
}
|
|
7802
7803
|
return result;
|
|
7803
7804
|
}
|
|
7804
|
-
}
|
|
7805
|
-
_type = new WeakMap();
|
|
7806
|
-
_to = new WeakMap();
|
|
7807
|
-
_data3 = new WeakMap();
|
|
7808
|
-
_nonce = new WeakMap();
|
|
7809
|
-
_gasLimit = new WeakMap();
|
|
7810
|
-
_gasPrice = new WeakMap();
|
|
7811
|
-
_maxPriorityFeePerGas = new WeakMap();
|
|
7812
|
-
_maxFeePerGas = new WeakMap();
|
|
7813
|
-
_value = new WeakMap();
|
|
7814
|
-
_chainId = new WeakMap();
|
|
7815
|
-
_sig = new WeakMap();
|
|
7816
|
-
_accessList = new WeakMap();
|
|
7817
|
-
_maxFeePerBlobGas = new WeakMap();
|
|
7818
|
-
_blobVersionedHashes = new WeakMap();
|
|
7819
|
-
_kzg = new WeakMap();
|
|
7820
|
-
_blobs = new WeakMap();
|
|
7821
|
-
_auths = new WeakMap();
|
|
7822
|
-
_getSerialized = new WeakSet();
|
|
7823
|
-
getSerialized_fn = function(signed2, sidecar) {
|
|
7805
|
+
}, _type = new WeakMap(), _to = new WeakMap(), _data3 = new WeakMap(), _nonce = new WeakMap(), _gasLimit = new WeakMap(), _gasPrice = new WeakMap(), _maxPriorityFeePerGas = new WeakMap(), _maxFeePerGas = new WeakMap(), _value = new WeakMap(), _chainId = new WeakMap(), _sig = new WeakMap(), _accessList = new WeakMap(), _maxFeePerBlobGas = new WeakMap(), _blobVersionedHashes = new WeakMap(), _kzg = new WeakMap(), _blobs = new WeakMap(), _auths = new WeakMap(), _getSerialized = new WeakSet(), getSerialized_fn = function(signed2, sidecar) {
|
|
7824
7806
|
assert(!signed2 || this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" });
|
|
7825
7807
|
const sig = signed2 ? this.signature : null;
|
|
7826
7808
|
switch (this.inferType()) {
|
|
@@ -7836,8 +7818,7 @@ getSerialized_fn = function(signed2, sidecar) {
|
|
|
7836
7818
|
return _serializeEip7702(this, sig);
|
|
7837
7819
|
}
|
|
7838
7820
|
assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" });
|
|
7839
|
-
};
|
|
7840
|
-
let Transaction = _Transaction;
|
|
7821
|
+
}, _a);
|
|
7841
7822
|
function id(value) {
|
|
7842
7823
|
return keccak256(toUtf8Bytes(value));
|
|
7843
7824
|
}
|
|
@@ -13540,7 +13521,7 @@ const _BaseContract = class _BaseContract {
|
|
|
13540
13521
|
/**
|
|
13541
13522
|
* @_ignore:
|
|
13542
13523
|
*/
|
|
13543
|
-
__publicField(this,
|
|
13524
|
+
__publicField(this, _b);
|
|
13544
13525
|
/**
|
|
13545
13526
|
* The fallback or receive function if any.
|
|
13546
13527
|
*/
|
|
@@ -13931,7 +13912,7 @@ const _BaseContract = class _BaseContract {
|
|
|
13931
13912
|
return contract;
|
|
13932
13913
|
}
|
|
13933
13914
|
};
|
|
13934
|
-
|
|
13915
|
+
_b = internal;
|
|
13935
13916
|
let BaseContract = _BaseContract;
|
|
13936
13917
|
function _ContractBase() {
|
|
13937
13918
|
return BaseContract;
|
|
@@ -15928,7 +15909,7 @@ class AbstractProvider {
|
|
|
15928
15909
|
}),
|
|
15929
15910
|
network: this.getNetwork()
|
|
15930
15911
|
});
|
|
15931
|
-
const tx = Transaction.from(signedTx);
|
|
15912
|
+
const tx = Transaction$1.from(signedTx);
|
|
15932
15913
|
if (tx.hash !== hash2) {
|
|
15933
15914
|
throw new Error("@TODO: the returned hash did not match");
|
|
15934
15915
|
}
|
|
@@ -16812,7 +16793,7 @@ class AbstractSigner {
|
|
|
16812
16793
|
const provider = checkProvider(this, "sendTransaction");
|
|
16813
16794
|
const pop = await this.populateTransaction(tx);
|
|
16814
16795
|
delete pop.from;
|
|
16815
|
-
const txObj = Transaction.from(pop);
|
|
16796
|
+
const txObj = Transaction$1.from(pop);
|
|
16816
16797
|
return await provider.broadcastTransaction(await this.signTransaction(txObj));
|
|
16817
16798
|
}
|
|
16818
16799
|
// @TODO: in v7 move this to be abstract
|
|
@@ -17984,6 +17965,31 @@ const _BrowserProvider = class _BrowserProvider extends JsonRpcApiPollingProvide
|
|
|
17984
17965
|
_request2 = new WeakMap();
|
|
17985
17966
|
_providerInfo = new WeakMap();
|
|
17986
17967
|
let BrowserProvider = _BrowserProvider;
|
|
17968
|
+
let Connection, PublicKey, Transaction, SystemProgram, LAMPORTS_PER_SOL;
|
|
17969
|
+
let createTransferInstruction, getAssociatedTokenAddress, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
17970
|
+
const initializeSolanaLibraries = async () => {
|
|
17971
|
+
try {
|
|
17972
|
+
if (!Connection) {
|
|
17973
|
+
const solanaWeb3 = await import("@solana/web3.js");
|
|
17974
|
+
Connection = solanaWeb3.Connection;
|
|
17975
|
+
PublicKey = solanaWeb3.PublicKey;
|
|
17976
|
+
Transaction = solanaWeb3.Transaction;
|
|
17977
|
+
SystemProgram = solanaWeb3.SystemProgram;
|
|
17978
|
+
LAMPORTS_PER_SOL = solanaWeb3.LAMPORTS_PER_SOL;
|
|
17979
|
+
}
|
|
17980
|
+
if (!createTransferInstruction) {
|
|
17981
|
+
const splToken = await import("./index-99d8107e.mjs");
|
|
17982
|
+
createTransferInstruction = splToken.createTransferInstruction;
|
|
17983
|
+
getAssociatedTokenAddress = splToken.getAssociatedTokenAddress;
|
|
17984
|
+
TOKEN_PROGRAM_ID = splToken.TOKEN_PROGRAM_ID;
|
|
17985
|
+
ASSOCIATED_TOKEN_PROGRAM_ID = splToken.ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
17986
|
+
}
|
|
17987
|
+
return true;
|
|
17988
|
+
} catch (error) {
|
|
17989
|
+
console.error("Failed to initialize Solana libraries:", error);
|
|
17990
|
+
return false;
|
|
17991
|
+
}
|
|
17992
|
+
};
|
|
17987
17993
|
const WALLET_TYPES = {
|
|
17988
17994
|
METAMASK: "metamask",
|
|
17989
17995
|
TRONLINK: "tronlink",
|
|
@@ -18628,6 +18634,10 @@ const sendNativeTransaction = async (walletConnection, toAddress, amount) => {
|
|
|
18628
18634
|
if (!phantomProvider || !phantomProvider.isConnected) {
|
|
18629
18635
|
throw new Error("Phantom wallet not connected");
|
|
18630
18636
|
}
|
|
18637
|
+
const solanaInitialized = await initializeSolanaLibraries();
|
|
18638
|
+
if (!solanaInitialized) {
|
|
18639
|
+
throw new Error("Failed to initialize Solana libraries. Please ensure @solana/web3.js is installed.");
|
|
18640
|
+
}
|
|
18631
18641
|
const amountFloat = parseFloat(amount);
|
|
18632
18642
|
console.log("Phantom SOL Transaction Debug:", {
|
|
18633
18643
|
originalAmount: amount,
|
|
@@ -18635,57 +18645,32 @@ const sendNativeTransaction = async (walletConnection, toAddress, amount) => {
|
|
|
18635
18645
|
walletType: "Phantom Native SOL"
|
|
18636
18646
|
});
|
|
18637
18647
|
try {
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
try {
|
|
18652
|
-
const solanaWeb3 = await import("@solana/web3.js");
|
|
18653
|
-
Connection = solanaWeb3.Connection;
|
|
18654
|
-
PublicKey = solanaWeb3.PublicKey;
|
|
18655
|
-
Transaction2 = solanaWeb3.Transaction;
|
|
18656
|
-
SystemProgram = solanaWeb3.SystemProgram;
|
|
18657
|
-
LAMPORTS_PER_SOL = solanaWeb3.LAMPORTS_PER_SOL;
|
|
18658
|
-
} catch (importError) {
|
|
18659
|
-
console.error("Failed to import Solana libraries:", importError);
|
|
18660
|
-
throw new Error("Solana libraries not available. Please ensure @solana/web3.js is installed.");
|
|
18661
|
-
}
|
|
18662
|
-
const connection = new Connection(NETWORK_CONFIG[NETWORK_TYPES.SOLANA].rpcUrl);
|
|
18663
|
-
const fromPubkey = walletConnection.publicKey;
|
|
18664
|
-
const toPubkey = new PublicKey(toAddress);
|
|
18665
|
-
const lamports = Math.floor(amountFloat * LAMPORTS_PER_SOL);
|
|
18666
|
-
console.log("Manual Solana transaction:", {
|
|
18667
|
-
from: fromPubkey.toString(),
|
|
18668
|
-
to: toAddress,
|
|
18669
|
-
amountSOL: amountFloat,
|
|
18670
|
-
lamports,
|
|
18671
|
-
conversionCheck: `${amountFloat} SOL = ${lamports} lamports`
|
|
18672
|
-
});
|
|
18673
|
-
if (lamports <= 0) {
|
|
18674
|
-
throw new Error(`Invalid amount: ${amountFloat} SOL converts to ${lamports} lamports`);
|
|
18675
|
-
}
|
|
18676
|
-
const transferTransaction = new Transaction2().add(
|
|
18677
|
-
SystemProgram.transfer({
|
|
18678
|
-
fromPubkey,
|
|
18679
|
-
toPubkey,
|
|
18680
|
-
lamports
|
|
18681
|
-
})
|
|
18682
|
-
);
|
|
18683
|
-
const { blockhash } = await connection.getLatestBlockhash();
|
|
18684
|
-
transferTransaction.recentBlockhash = blockhash;
|
|
18685
|
-
transferTransaction.feePayer = fromPubkey;
|
|
18686
|
-
const signedTransaction = await phantomProvider.signAndSendTransaction(transferTransaction);
|
|
18687
|
-
transaction = signedTransaction;
|
|
18648
|
+
const connection = new Connection(NETWORK_CONFIG[NETWORK_TYPES.SOLANA].rpcUrl);
|
|
18649
|
+
const fromPubkey = walletConnection.publicKey;
|
|
18650
|
+
const toPubkey = new PublicKey(toAddress);
|
|
18651
|
+
const lamports = Math.floor(amountFloat * LAMPORTS_PER_SOL);
|
|
18652
|
+
console.log("Solana native transaction:", {
|
|
18653
|
+
from: fromPubkey.toString(),
|
|
18654
|
+
to: toAddress,
|
|
18655
|
+
amountSOL: amountFloat,
|
|
18656
|
+
lamports,
|
|
18657
|
+
conversionCheck: `${amountFloat} SOL = ${lamports} lamports`
|
|
18658
|
+
});
|
|
18659
|
+
if (lamports <= 0) {
|
|
18660
|
+
throw new Error(`Invalid amount: ${amountFloat} SOL converts to ${lamports} lamports`);
|
|
18688
18661
|
}
|
|
18662
|
+
const transferTransaction = new Transaction().add(
|
|
18663
|
+
SystemProgram.transfer({
|
|
18664
|
+
fromPubkey,
|
|
18665
|
+
toPubkey,
|
|
18666
|
+
lamports
|
|
18667
|
+
})
|
|
18668
|
+
);
|
|
18669
|
+
const { blockhash } = await connection.getLatestBlockhash();
|
|
18670
|
+
transferTransaction.recentBlockhash = blockhash;
|
|
18671
|
+
transferTransaction.feePayer = fromPubkey;
|
|
18672
|
+
const signedTransaction = await phantomProvider.signAndSendTransaction(transferTransaction);
|
|
18673
|
+
transaction = signedTransaction;
|
|
18689
18674
|
} catch (phantomError) {
|
|
18690
18675
|
console.error("Phantom transaction error:", phantomError);
|
|
18691
18676
|
throw new Error(`Phantom transaction failed: ${phantomError.message || "Unknown error"}`);
|
|
@@ -18751,7 +18736,6 @@ const sendTokenTransaction = async (walletConnection, tokenConfig, toAddress, am
|
|
|
18751
18736
|
const sendSolanaTokenTransaction = async (walletConnection, tokenConfig, toAddress, amount) => {
|
|
18752
18737
|
console.log("=== SOLANA TOKEN TRANSACTION DEBUG ===");
|
|
18753
18738
|
console.log("Input params:", { tokenConfig, toAddress, amount });
|
|
18754
|
-
console.log("Wallet connection:", walletConnection);
|
|
18755
18739
|
if (!walletConnection || !walletConnection.provider) {
|
|
18756
18740
|
throw new Error("Phantom wallet not connected");
|
|
18757
18741
|
}
|
|
@@ -18762,6 +18746,10 @@ const sendSolanaTokenTransaction = async (walletConnection, tokenConfig, toAddre
|
|
|
18762
18746
|
if (!tokenConfig || !tokenConfig.contractAddress) {
|
|
18763
18747
|
throw new Error("Invalid token configuration");
|
|
18764
18748
|
}
|
|
18749
|
+
const solanaInitialized = await initializeSolanaLibraries();
|
|
18750
|
+
if (!solanaInitialized) {
|
|
18751
|
+
throw new Error("Failed to initialize Solana libraries. Please ensure @solana/web3.js and @solana/spl-token are installed.");
|
|
18752
|
+
}
|
|
18765
18753
|
const { contractAddress, decimals, symbol } = tokenConfig;
|
|
18766
18754
|
const tokenAmount = parseFloat(amount);
|
|
18767
18755
|
const tokenDecimals = parseInt(decimals);
|
|
@@ -18783,24 +18771,9 @@ const sendSolanaTokenTransaction = async (walletConnection, tokenConfig, toAddre
|
|
|
18783
18771
|
throw new Error(`Invalid amount: ${tokenAmount} ${symbol} converts to ${amountInSmallestUnit} base units`);
|
|
18784
18772
|
}
|
|
18785
18773
|
if (tokenAmount < 1 && amountInSmallestUnit === 0) {
|
|
18786
|
-
throw new Error(`Amount too small: ${tokenAmount} ${symbol} is smaller than the minimum unit
|
|
18774
|
+
throw new Error(`Amount too small: ${tokenAmount} ${symbol} is smaller than the minimum unit`);
|
|
18787
18775
|
}
|
|
18788
18776
|
try {
|
|
18789
|
-
let Connection, PublicKey, Transaction2, createTransferInstruction, getAssociatedTokenAddress, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
18790
|
-
try {
|
|
18791
|
-
const solanaWeb3 = await import("@solana/web3.js");
|
|
18792
|
-
const splToken = await import("./index-e49d97f5.mjs");
|
|
18793
|
-
Connection = solanaWeb3.Connection;
|
|
18794
|
-
PublicKey = solanaWeb3.PublicKey;
|
|
18795
|
-
Transaction2 = solanaWeb3.Transaction;
|
|
18796
|
-
createTransferInstruction = splToken.createTransferInstruction;
|
|
18797
|
-
getAssociatedTokenAddress = splToken.getAssociatedTokenAddress;
|
|
18798
|
-
TOKEN_PROGRAM_ID = splToken.TOKEN_PROGRAM_ID;
|
|
18799
|
-
ASSOCIATED_TOKEN_PROGRAM_ID = splToken.ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
18800
|
-
} catch (importError) {
|
|
18801
|
-
console.error("Failed to import Solana libraries:", importError);
|
|
18802
|
-
throw new Error("Solana libraries not available. Please ensure @solana/web3.js and @solana/spl-token are installed.");
|
|
18803
|
-
}
|
|
18804
18777
|
const connection = new Connection(NETWORK_CONFIG[NETWORK_TYPES.SOLANA].rpcUrl);
|
|
18805
18778
|
const fromPubkey = walletConnection.publicKey;
|
|
18806
18779
|
const toPubkey = new PublicKey(toAddress);
|
|
@@ -18837,7 +18810,7 @@ const sendSolanaTokenTransaction = async (walletConnection, tokenConfig, toAddre
|
|
|
18837
18810
|
[],
|
|
18838
18811
|
TOKEN_PROGRAM_ID
|
|
18839
18812
|
);
|
|
18840
|
-
const transaction = new
|
|
18813
|
+
const transaction = new Transaction().add(transferInstruction);
|
|
18841
18814
|
const { blockhash } = await connection.getLatestBlockhash();
|
|
18842
18815
|
transaction.recentBlockhash = blockhash;
|
|
18843
18816
|
transaction.feePayer = fromPubkey;
|
|
@@ -18855,7 +18828,7 @@ const sendSolanaTokenTransaction = async (walletConnection, tokenConfig, toAddre
|
|
|
18855
18828
|
throw new Error("Insufficient token balance");
|
|
18856
18829
|
} else if (error.message && error.message.includes("Invalid amount") || error.message && error.message.includes("Amount too small")) {
|
|
18857
18830
|
throw error;
|
|
18858
|
-
} else if (error.message && error.message.includes("Solana libraries
|
|
18831
|
+
} else if (error.message && error.message.includes("Failed to initialize Solana libraries")) {
|
|
18859
18832
|
throw error;
|
|
18860
18833
|
} else {
|
|
18861
18834
|
throw new Error(`Token transaction failed: ${error.message || "Unknown error"}`);
|
|
@@ -20423,7 +20396,7 @@ var QRCodeCanvas = React.forwardRef(
|
|
|
20423
20396
|
"marginSize",
|
|
20424
20397
|
"imageSettings"
|
|
20425
20398
|
]);
|
|
20426
|
-
const
|
|
20399
|
+
const _b2 = extraProps, { style } = _b2, otherProps = __objRest(_b2, ["style"]);
|
|
20427
20400
|
const imgSrc = imageSettings == null ? void 0 : imageSettings.src;
|
|
20428
20401
|
const _canvas = React.useRef(null);
|
|
20429
20402
|
const _image = React.useRef(null);
|