@funkit/core 2.2.0 → 2.2.1
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 +46 -61
- package/dist/index.js.map +3 -3
- package/dist/src/common/constants.d.ts +66 -66
- package/dist/src/utils/CheckoutUtils.d.ts +0 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11360,20 +11360,6 @@ var useFaucet = async (chainIdentifier, wallet) => {
|
|
|
11360
11360
|
};
|
|
11361
11361
|
|
|
11362
11362
|
// src/utils/CheckoutUtils.ts
|
|
11363
|
-
async function getDecimals({
|
|
11364
|
-
chainId,
|
|
11365
|
-
tokenAddress
|
|
11366
|
-
}) {
|
|
11367
|
-
if (tokenAddress === FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS) {
|
|
11368
|
-
return FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[chainId].nativeCurrency.decimals;
|
|
11369
|
-
}
|
|
11370
|
-
if (chainId === dydxChain.id.toString() && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[chainId].checkoutAssetWhitelist?.[0] === tokenAddress.toLowerCase()) {
|
|
11371
|
-
return 6;
|
|
11372
|
-
}
|
|
11373
|
-
const chain = await Chain.getChain({ chainIdentifier: chainId });
|
|
11374
|
-
const token = new Token(tokenAddress, chain);
|
|
11375
|
-
return Number(await token.getDecimals());
|
|
11376
|
-
}
|
|
11377
11363
|
function generateRandomCheckoutSalt() {
|
|
11378
11364
|
return BigInt(randomBytes(32));
|
|
11379
11365
|
}
|
|
@@ -11399,7 +11385,7 @@ import { JSBI } from "@uniswap/sdk";
|
|
|
11399
11385
|
import {
|
|
11400
11386
|
CurrencyAmount,
|
|
11401
11387
|
Percent,
|
|
11402
|
-
Token
|
|
11388
|
+
Token,
|
|
11403
11389
|
TradeType
|
|
11404
11390
|
} from "@uniswap/sdk-core";
|
|
11405
11391
|
import {
|
|
@@ -11612,8 +11598,8 @@ async function swapExec(client, uniswapAddrs, swapParams, chainId) {
|
|
|
11612
11598
|
const swapper = new SwapToken(client, 3, univ3quoter, univ3factory);
|
|
11613
11599
|
const tokenInDecimal = await swapper.getTokenDecimals(tokenInAddress);
|
|
11614
11600
|
const tokenOutDecimal = await swapper.getTokenDecimals(tokenOutAddress);
|
|
11615
|
-
const tokenIn = new
|
|
11616
|
-
const tokenOut = new
|
|
11601
|
+
const tokenIn = new Token(chainId, tokenInAddress, tokenInDecimal);
|
|
11602
|
+
const tokenOut = new Token(chainId, tokenOutAddress, tokenOutDecimal);
|
|
11617
11603
|
const { uncheckedTrade, tokenInAmount } = await swapper.createTrade(
|
|
11618
11604
|
amountIn,
|
|
11619
11605
|
tokenIn,
|
|
@@ -12815,7 +12801,7 @@ function toBytes32Arr(data) {
|
|
|
12815
12801
|
// src/data/Token.ts
|
|
12816
12802
|
import { formatUnits as formatUnits2, isAddress as isAddress3, parseUnits as parseUnits2 } from "viem";
|
|
12817
12803
|
var wrappedNativeTokens = { eth: "weth", matic: "wmatic", mnt: "wmnt" };
|
|
12818
|
-
var
|
|
12804
|
+
var Token2 = class _Token {
|
|
12819
12805
|
address;
|
|
12820
12806
|
chain;
|
|
12821
12807
|
isNative = false;
|
|
@@ -14221,7 +14207,7 @@ var createFeeRecipientAndTokenMerkleTree = async (params) => {
|
|
|
14221
14207
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
14222
14208
|
const tokens = await Promise.all(
|
|
14223
14209
|
(params.feeTokenWhitelist ?? []).map(
|
|
14224
|
-
(token) =>
|
|
14210
|
+
(token) => Token2.getAddress(token, chain)
|
|
14225
14211
|
)
|
|
14226
14212
|
);
|
|
14227
14213
|
const feeRecipientAndTokenMerkleTree = new MerkleTree([
|
|
@@ -14695,8 +14681,8 @@ var oneInchTransactionParams = async (params, walletAddress, txOptions = globalT
|
|
|
14695
14681
|
);
|
|
14696
14682
|
}
|
|
14697
14683
|
const approveAndExecAddress = await chain.getAddress("approveAndExecAddress");
|
|
14698
|
-
const inToken = new
|
|
14699
|
-
const outToken = new
|
|
14684
|
+
const inToken = new Token2(params.tokenIn, chain);
|
|
14685
|
+
const outToken = new Token2(params.tokenOut, chain);
|
|
14700
14686
|
const inTokenAddress = inToken.isNative ? eth1InchAddress : await inToken.getAddress();
|
|
14701
14687
|
const outTokenAddress = outToken.isNative ? eth1InchAddress : await outToken.getAddress();
|
|
14702
14688
|
const oneinchSwapParams = {
|
|
@@ -14728,8 +14714,8 @@ var uniswapV3SwapTransactionParams = async (params, txOptions = globalThis.globa
|
|
|
14728
14714
|
const univ3quoter = await chain.getAddress("univ3quoter");
|
|
14729
14715
|
const univ3factory = await chain.getAddress("univ3factory");
|
|
14730
14716
|
const univ3router = await chain.getAddress("univ3router");
|
|
14731
|
-
const tokenIn = new
|
|
14732
|
-
const tokenOut = new
|
|
14717
|
+
const tokenIn = new Token2(params.tokenIn, chain);
|
|
14718
|
+
const tokenOut = new Token2(params.tokenOut, chain);
|
|
14733
14719
|
const tokenInAddress = await tokenIn.getAddress();
|
|
14734
14720
|
const tokenOutAddress = await tokenOut.getAddress();
|
|
14735
14721
|
const uniswapAddrs = {
|
|
@@ -14788,8 +14774,8 @@ var uniswapV2SwapTransactionParams = async (params, txOptions = globalThis.globa
|
|
|
14788
14774
|
const tokenSwapAddress = await chain.getAddress("tokenSwapAddress");
|
|
14789
14775
|
const factory = await chain.getAddress("UniswapV2Factory");
|
|
14790
14776
|
const router = await chain.getAddress("UniswapV2Router02");
|
|
14791
|
-
const tokenIn = new
|
|
14792
|
-
const tokenOut = new
|
|
14777
|
+
const tokenIn = new Token2(params.tokenIn, chain);
|
|
14778
|
+
const tokenOut = new Token2(params.tokenOut, chain);
|
|
14793
14779
|
const tokenInAddress = await tokenIn.getAddress();
|
|
14794
14780
|
const tokenOutAddress = await tokenOut.getAddress();
|
|
14795
14781
|
const uniswapAddrs = {
|
|
@@ -14876,7 +14862,7 @@ var tokenTransferTransactionParams = async (params, chain) => {
|
|
|
14876
14862
|
"https://docs.fun.xyz"
|
|
14877
14863
|
);
|
|
14878
14864
|
}
|
|
14879
|
-
const tokenObj = new
|
|
14865
|
+
const tokenObj = new Token2(token, chain);
|
|
14880
14866
|
if (tokenObj.isNative) {
|
|
14881
14867
|
return {
|
|
14882
14868
|
to,
|
|
@@ -14913,7 +14899,7 @@ var tokenTransferFromTransactionParams = async (params, chain) => {
|
|
|
14913
14899
|
"https://docs.fun.xyz"
|
|
14914
14900
|
);
|
|
14915
14901
|
}
|
|
14916
|
-
const tokenObj = new
|
|
14902
|
+
const tokenObj = new Token2(token, chain);
|
|
14917
14903
|
if (tokenObj.isNative) {
|
|
14918
14904
|
return {
|
|
14919
14905
|
to,
|
|
@@ -14959,7 +14945,7 @@ var erc20ApproveTransactionParams = async (params) => {
|
|
|
14959
14945
|
const chain = await Chain.getChain({
|
|
14960
14946
|
chainIdentifier: globalThis.globalEnvOption.chain
|
|
14961
14947
|
});
|
|
14962
|
-
const tokenObj = new
|
|
14948
|
+
const tokenObj = new Token2(token, chain);
|
|
14963
14949
|
const convertedAmount = await tokenObj.getDecimalAmount(amount);
|
|
14964
14950
|
return ERC20_CONTRACT_INTERFACE.encodeTransactionParams(
|
|
14965
14951
|
await tokenObj.getAddress(),
|
|
@@ -15168,7 +15154,7 @@ var CheckoutSponsor = class extends Sponsor {
|
|
|
15168
15154
|
}
|
|
15169
15155
|
async stake(_sponsor, amount, options) {
|
|
15170
15156
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15171
|
-
const amountdec = await
|
|
15157
|
+
const amountdec = await Token2.getDecimalAmount("eth", amount, chain);
|
|
15172
15158
|
return this.contractInterface.encodeTransactionParams(
|
|
15173
15159
|
await this.getPaymasterAddress(),
|
|
15174
15160
|
"deposit",
|
|
@@ -15178,7 +15164,7 @@ var CheckoutSponsor = class extends Sponsor {
|
|
|
15178
15164
|
}
|
|
15179
15165
|
async unstake(receiver, amount, options) {
|
|
15180
15166
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15181
|
-
const amountdec = await
|
|
15167
|
+
const amountdec = await Token2.getDecimalAmount("eth", amount, chain);
|
|
15182
15168
|
return this.contractInterface.encodeTransactionParams(
|
|
15183
15169
|
await this.getPaymasterAddress(),
|
|
15184
15170
|
"withdrawTo",
|
|
@@ -15274,7 +15260,7 @@ var GaslessSponsor = class extends Sponsor {
|
|
|
15274
15260
|
}
|
|
15275
15261
|
async stake(sponsor, amount, options = globalThis.globalEnvOption) {
|
|
15276
15262
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15277
|
-
const amountdec = await
|
|
15263
|
+
const amountdec = await Token2.getDecimalAmount("eth", amount, chain);
|
|
15278
15264
|
return this.contractInterface.encodeTransactionParams(
|
|
15279
15265
|
await this.getPaymasterAddress(),
|
|
15280
15266
|
"addDepositTo",
|
|
@@ -15284,7 +15270,7 @@ var GaslessSponsor = class extends Sponsor {
|
|
|
15284
15270
|
}
|
|
15285
15271
|
async unstake(receiver, amount, options = globalThis.globalEnvOption) {
|
|
15286
15272
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15287
|
-
const amountdec = await
|
|
15273
|
+
const amountdec = await Token2.getDecimalAmount("eth", amount, chain);
|
|
15288
15274
|
return this.contractInterface.encodeTransactionParams(
|
|
15289
15275
|
await this.getPaymasterAddress(),
|
|
15290
15276
|
"withdrawDepositTo",
|
|
@@ -15400,7 +15386,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15400
15386
|
const chain = await Chain.getChain({
|
|
15401
15387
|
chainIdentifier: globalThis.globalEnvOption.chain
|
|
15402
15388
|
});
|
|
15403
|
-
const tokenAddress = await
|
|
15389
|
+
const tokenAddress = await Token2.getAddress(this.token, chain);
|
|
15404
15390
|
const paymasterAddress = await this.getPaymasterAddress(options);
|
|
15405
15391
|
const sponsor = await this.getFunSponsorAddress(options);
|
|
15406
15392
|
return concat4([paymasterAddress, sponsor, tokenAddress]);
|
|
@@ -15422,7 +15408,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15422
15408
|
const { maxFeePerGas } = await chain.getFeeData();
|
|
15423
15409
|
const paymasterAddress = await this.getPaymasterAddress(options);
|
|
15424
15410
|
const requiredGas = (callGasLimit + (verificationGasLimit + 400000n) * 3n + preVerificationGas) * BigInt(maxFeePerGas);
|
|
15425
|
-
const tokenAddress = await
|
|
15411
|
+
const tokenAddress = await Token2.getAddress(this.token, chain);
|
|
15426
15412
|
const decAmount = await TOKEN_PAYMASTER_CONTRACT_INTERFACE.readFromChain(
|
|
15427
15413
|
paymasterAddress,
|
|
15428
15414
|
"getTokenValueOfEth",
|
|
@@ -15465,7 +15451,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15465
15451
|
async stake(sponsor, amount, options = globalThis.globalEnvOption) {
|
|
15466
15452
|
const chainIdentifier = options.chain ?? globalThis.globalEnvOption.chain;
|
|
15467
15453
|
const chain = await Chain.getChain({ chainIdentifier });
|
|
15468
|
-
const amountdec = await
|
|
15454
|
+
const amountdec = await Token2.getDecimalAmount("eth", amount, chain);
|
|
15469
15455
|
return this.contractInterface.encodeTransactionParams(
|
|
15470
15456
|
await this.getPaymasterAddress(),
|
|
15471
15457
|
"addEthDepositTo",
|
|
@@ -15476,7 +15462,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15476
15462
|
async unstake(receiver, amount, options = globalThis.globalEnvOption) {
|
|
15477
15463
|
const chainIdentifier = options.chain ?? globalThis.globalEnvOption.chain;
|
|
15478
15464
|
const chain = await Chain.getChain({ chainIdentifier });
|
|
15479
|
-
const amountdec = await
|
|
15465
|
+
const amountdec = await Token2.getDecimalAmount("eth", amount, chain);
|
|
15480
15466
|
return this.contractInterface.encodeTransactionParams(
|
|
15481
15467
|
await this.getPaymasterAddress(),
|
|
15482
15468
|
"withdrawEthDepositTo",
|
|
@@ -15487,13 +15473,13 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15487
15473
|
const chain = await Chain.getChain({
|
|
15488
15474
|
chainIdentifier: globalThis.globalEnvOption.chain
|
|
15489
15475
|
});
|
|
15490
|
-
const tokenAddr = await
|
|
15476
|
+
const tokenAddr = await Token2.isNative(token) ? AddressZero : await Token2.getAddress(token, chain);
|
|
15491
15477
|
return (await this.getAllTokenData(tokenAddr, sponsor, options)).unlockBlock;
|
|
15492
15478
|
}
|
|
15493
15479
|
// false means unlocked, true means locked
|
|
15494
15480
|
async getLockState(sponsor, token, options = globalThis.globalEnvOption) {
|
|
15495
15481
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15496
|
-
const tokenAddr = await
|
|
15482
|
+
const tokenAddr = await Token2.isNative(token) ? AddressZero : await Token2.getAddress(token, chain);
|
|
15497
15483
|
const unlockBlock = await this.getUnlockBlock(tokenAddr, sponsor);
|
|
15498
15484
|
const provider = await chain.getClient();
|
|
15499
15485
|
const currentBlock = await provider.getBlockNumber();
|
|
@@ -15501,7 +15487,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15501
15487
|
}
|
|
15502
15488
|
async getTokenInfo(token, options = globalThis.globalEnvOption) {
|
|
15503
15489
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15504
|
-
const tokenAddress = await
|
|
15490
|
+
const tokenAddress = await Token2.getAddress(token, chain);
|
|
15505
15491
|
return await this.contractInterface.readFromChain(
|
|
15506
15492
|
await this.getPaymasterAddress(options),
|
|
15507
15493
|
"getToken",
|
|
@@ -15511,7 +15497,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15511
15497
|
}
|
|
15512
15498
|
async getAllTokenData(spender, token, options = globalThis.globalEnvOption) {
|
|
15513
15499
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15514
|
-
const tokenAddress = await
|
|
15500
|
+
const tokenAddress = await Token2.getAddress(token, chain);
|
|
15515
15501
|
const data = await this.contractInterface.readFromChain(
|
|
15516
15502
|
await this.getPaymasterAddress(options),
|
|
15517
15503
|
"getAllTokenData",
|
|
@@ -15525,7 +15511,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15525
15511
|
}
|
|
15526
15512
|
async getTokenBalance(spender, token, options = globalThis.globalEnvOption) {
|
|
15527
15513
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15528
|
-
const tokenData = new
|
|
15514
|
+
const tokenData = new Token2(token, chain);
|
|
15529
15515
|
let tokenAddress;
|
|
15530
15516
|
if (tokenData.isNative) {
|
|
15531
15517
|
tokenAddress = AddressZero;
|
|
@@ -15550,8 +15536,8 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15550
15536
|
}
|
|
15551
15537
|
async addUsableToken(oracle, token, aggregator, options = globalThis.globalEnvOption) {
|
|
15552
15538
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15553
|
-
const decimals = await
|
|
15554
|
-
const tokenAddress = await
|
|
15539
|
+
const decimals = await Token2.getDecimals(token, chain);
|
|
15540
|
+
const tokenAddress = await Token2.getAddress(token, chain);
|
|
15555
15541
|
const data = [oracle, tokenAddress, decimals, aggregator];
|
|
15556
15542
|
return this.contractInterface.encodeTransactionParams(
|
|
15557
15543
|
await this.getPaymasterAddress(),
|
|
@@ -15561,7 +15547,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15561
15547
|
}
|
|
15562
15548
|
async depositToken(token, spender, amount, options = globalThis.globalEnvOption) {
|
|
15563
15549
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15564
|
-
const tokenObj = new
|
|
15550
|
+
const tokenObj = new Token2(token, chain);
|
|
15565
15551
|
const tokenAddress = await tokenObj.getAddress();
|
|
15566
15552
|
const amountDec = await tokenObj.getDecimalAmount(amount);
|
|
15567
15553
|
return this.contractInterface.encodeTransactionParams(
|
|
@@ -15572,7 +15558,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15572
15558
|
}
|
|
15573
15559
|
async withdrawToken(token, receiver, amount, options = globalThis.globalEnvOption) {
|
|
15574
15560
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15575
|
-
const tokenObj = new
|
|
15561
|
+
const tokenObj = new Token2(token, chain);
|
|
15576
15562
|
const tokenAddress = await tokenObj.getAddress();
|
|
15577
15563
|
const amountdec = await tokenObj.getDecimalAmount(amount);
|
|
15578
15564
|
return this.contractInterface.encodeTransactionParams(
|
|
@@ -15583,7 +15569,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15583
15569
|
}
|
|
15584
15570
|
async lockTokenDeposit(token, options = globalThis.globalEnvOption) {
|
|
15585
15571
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15586
|
-
const tokenData = new
|
|
15572
|
+
const tokenData = new Token2(token, chain);
|
|
15587
15573
|
const tokenAddress = tokenData.isNative ? AddressZero : await tokenData.getAddress();
|
|
15588
15574
|
return this.contractInterface.encodeTransactionParams(
|
|
15589
15575
|
await this.getPaymasterAddress(),
|
|
@@ -15593,7 +15579,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15593
15579
|
}
|
|
15594
15580
|
async unlockTokenDepositAfter(token, blocksToWait, options = globalThis.globalEnvOption) {
|
|
15595
15581
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15596
|
-
const tokenData = new
|
|
15582
|
+
const tokenData = new Token2(token, chain);
|
|
15597
15583
|
const tokenAddress = tokenData.isNative ? AddressZero : await tokenData.getAddress();
|
|
15598
15584
|
return this.contractInterface.encodeTransactionParams(
|
|
15599
15585
|
await this.getPaymasterAddress(),
|
|
@@ -15632,7 +15618,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15632
15618
|
this.paymasterType,
|
|
15633
15619
|
approver
|
|
15634
15620
|
);
|
|
15635
|
-
return
|
|
15621
|
+
return Token2.approve(token, gasSponsorAddress, amount, chain);
|
|
15636
15622
|
}
|
|
15637
15623
|
async getSpenderBlacklisted(spender, sponsor, options = globalThis.globalEnvOption) {
|
|
15638
15624
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
@@ -15654,7 +15640,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15654
15640
|
}
|
|
15655
15641
|
async getTokenWhitelisted(sponsor, token, options = globalThis.globalEnvOption) {
|
|
15656
15642
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15657
|
-
const tokenAddress = await
|
|
15643
|
+
const tokenAddress = await Token2.getAddress(token, chain);
|
|
15658
15644
|
return await this.contractInterface.readFromChain(
|
|
15659
15645
|
await this.getPaymasterAddress(options),
|
|
15660
15646
|
"getTokenWhitelisted",
|
|
@@ -15673,7 +15659,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15673
15659
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15674
15660
|
const calldata = [];
|
|
15675
15661
|
for (let i = 0; i < tokens.length; i++) {
|
|
15676
|
-
const tokenAddress = await
|
|
15662
|
+
const tokenAddress = await Token2.getAddress(tokens[i], chain);
|
|
15677
15663
|
calldata.push(
|
|
15678
15664
|
this.contractInterface.encodeData("setTokenWhitelistMode", [
|
|
15679
15665
|
tokenAddress,
|
|
@@ -15698,7 +15684,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15698
15684
|
}
|
|
15699
15685
|
async getTokenBlacklisted(sponsor, token, options = globalThis.globalEnvOption) {
|
|
15700
15686
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15701
|
-
const tokenAddress = await
|
|
15687
|
+
const tokenAddress = await Token2.getAddress(token, chain);
|
|
15702
15688
|
return await this.contractInterface.readFromChain(
|
|
15703
15689
|
await this.getPaymasterAddress(options),
|
|
15704
15690
|
"getTokenBlacklisted",
|
|
@@ -15717,7 +15703,7 @@ var TokenSponsor = class extends Sponsor {
|
|
|
15717
15703
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
15718
15704
|
const calldata = [];
|
|
15719
15705
|
for (let i = 0; i < tokens.length; i++) {
|
|
15720
|
-
const tokenAddress = await
|
|
15706
|
+
const tokenAddress = await Token2.getAddress(tokens[i], chain);
|
|
15721
15707
|
calldata.push(
|
|
15722
15708
|
this.contractInterface.encodeTransactionParams(
|
|
15723
15709
|
await this.getPaymasterAddress(),
|
|
@@ -15872,8 +15858,8 @@ async function getSocketBridgeApproveTransaction(chainId, sender, allowanceTarge
|
|
|
15872
15858
|
// src/actions/Bridge.ts
|
|
15873
15859
|
var bridgeTransactionParams = async (params, walletAddress, chain) => {
|
|
15874
15860
|
const { recipient, fromToken, toToken, sort } = params;
|
|
15875
|
-
const fromTokenObj = new
|
|
15876
|
-
const toTokenObj = new
|
|
15861
|
+
const fromTokenObj = new Token2(fromToken, chain);
|
|
15862
|
+
const toTokenObj = new Token2(toToken, chain);
|
|
15877
15863
|
const amount = await fromTokenObj.getDecimalAmount(params.amount);
|
|
15878
15864
|
if (!recipient) {
|
|
15879
15865
|
throw new InvalidParameterError(
|
|
@@ -15950,12 +15936,12 @@ var fees2 = {
|
|
|
15950
15936
|
};
|
|
15951
15937
|
var limitSwapOrderTransactionParams = async (params, chain) => {
|
|
15952
15938
|
const { tokenIn, tokenOut, tokenInAmount, tokenOutAmount, poolFee } = params;
|
|
15953
|
-
const tokenInAddress = await new
|
|
15954
|
-
const tokenOutAddress = await new
|
|
15955
|
-
const amountIn = await new
|
|
15939
|
+
const tokenInAddress = await new Token2(tokenIn, chain).getAddress();
|
|
15940
|
+
const tokenOutAddress = await new Token2(tokenOut, chain).getAddress();
|
|
15941
|
+
const amountIn = await new Token2(tokenIn, chain).getDecimalAmount(
|
|
15956
15942
|
tokenInAmount
|
|
15957
15943
|
);
|
|
15958
|
-
const amountOut = await new
|
|
15944
|
+
const amountOut = await new Token2(tokenOut, chain).getDecimalAmount(
|
|
15959
15945
|
tokenOutAmount
|
|
15960
15946
|
);
|
|
15961
15947
|
const uniswapv3LimitOrderAddress = await chain.getAddress(
|
|
@@ -17361,7 +17347,7 @@ var FunWallet = class extends FirstClassActions {
|
|
|
17361
17347
|
);
|
|
17362
17348
|
}
|
|
17363
17349
|
const chain = await Chain.getChain({ chainIdentifier: options.chain });
|
|
17364
|
-
const token = new
|
|
17350
|
+
const token = new Token2(options.fee.token, chain);
|
|
17365
17351
|
if (options.fee.gasPercent && !token.isNative) {
|
|
17366
17352
|
throw new InvalidParameterError(
|
|
17367
17353
|
"InvalidParameterCombination" /* InvalidParameterCombination */,
|
|
@@ -17499,7 +17485,7 @@ export {
|
|
|
17499
17485
|
TOKEN_PAYMASTER_CONTRACT_INTERFACE,
|
|
17500
17486
|
TOKEN_SPONSOR_SUPPORT_CHAINS,
|
|
17501
17487
|
ThrottlingError,
|
|
17502
|
-
Token,
|
|
17488
|
+
Token2 as Token,
|
|
17503
17489
|
TokenSponsor,
|
|
17504
17490
|
UNISWAPV2FACTORY_ABI,
|
|
17505
17491
|
UNISWAPV2FACTORY_INTERFACE,
|
|
@@ -17562,7 +17548,6 @@ export {
|
|
|
17562
17548
|
getChainFromId,
|
|
17563
17549
|
getChainFromName,
|
|
17564
17550
|
getContractAbi,
|
|
17565
|
-
getDecimals,
|
|
17566
17551
|
getEnvOptions,
|
|
17567
17552
|
getFullReceipt,
|
|
17568
17553
|
getGasPrice,
|