@depay/web3-wallets-evm 15.12.4 → 15.14.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/README.md +11 -27
- package/dist/esm/index.evm.js +110 -61
- package/dist/esm/index.js +28 -7
- package/dist/esm/index.solana.js +108 -59
- package/dist/umd/index.evm.js +110 -61
- package/dist/umd/index.js +28 -7
- package/dist/umd/index.solana.js +108 -59
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -36,30 +36,14 @@ This library supports the following blockchains:
|
|
|
36
36
|
- [Polygon](https://polygon.technology)
|
|
37
37
|
- [Solana](https://solana.com)
|
|
38
38
|
- [Fantom](https://fantom.foundation)
|
|
39
|
-
- [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
100+ different wallets via [WalletConnect](https://walletconnect.org), such as:
|
|
49
|
-
- [Trust Wallet](https://trustwallet.com)
|
|
50
|
-
- [DeFi Wallet by crypto.com](https://crypto.com/defi-wallet)
|
|
51
|
-
- [1inch Wallet](https://1inch.io/wallet/)
|
|
52
|
-
- [imToken Wallet](https://www.token.im)
|
|
53
|
-
- [TokenPocket](https://www.tokenpocket.pro/en)
|
|
54
|
-
- [Pillar](https://www.pillar.fi/)
|
|
55
|
-
- [Math Wallet](https://mathwallet.org/)
|
|
56
|
-
- [Ledger Live](https://www.ledger.com/ledger-live)
|
|
57
|
-
- [Argent Wallet](https://www.argent.xyz)
|
|
58
|
-
- [AlphaWallet](https://alphawallet.com/)
|
|
59
|
-
- [Unstoppable Wallet](https://unstoppable.money)
|
|
60
|
-
- [Atomic Wallet](https://atomicwallet.io)
|
|
61
|
-
- [Rainbow](https://rainbow.me/)
|
|
62
|
-
- and more...
|
|
39
|
+
- [Arbitrum](https://arbitrum.io)
|
|
40
|
+
- [Avalanche](https://www.avax.network)
|
|
41
|
+
- [Gnosis](https://gnosis.io)
|
|
42
|
+
- [Optimism](https://www.optimism.io)
|
|
43
|
+
|
|
44
|
+
This library supports most crypto wallets:
|
|
45
|
+
|
|
46
|
+
See https://depay.com/wallets for more details
|
|
63
47
|
|
|
64
48
|
## Platform specific packaging
|
|
65
49
|
|
|
@@ -354,7 +338,7 @@ let sentTransaction = await wallet.sendTransaction({
|
|
|
354
338
|
e.g. Send 1 USDC:
|
|
355
339
|
|
|
356
340
|
```javascript
|
|
357
|
-
import
|
|
341
|
+
import Token from '@depay/web3-tokens'
|
|
358
342
|
|
|
359
343
|
let sentTransaction = await wallet.sendTransaction({
|
|
360
344
|
blockchain: 'solana',
|
|
@@ -380,7 +364,7 @@ you can pass `signers` as part of the transaction passed to `sendTransaction`:
|
|
|
380
364
|
|
|
381
365
|
```javascript
|
|
382
366
|
import { getProvider } from '@depay/web3-client'
|
|
383
|
-
import
|
|
367
|
+
import Token from '@depay/web3-tokens'
|
|
384
368
|
import { PublicKey, SystemProgram, Keypair } from '@depay/solana-web3.js'
|
|
385
369
|
|
|
386
370
|
const wallets = await getWallets()
|
|
@@ -417,7 +401,7 @@ you can pass `alts` as part of the transaction passed to `sendTransaction`:
|
|
|
417
401
|
|
|
418
402
|
```javascript
|
|
419
403
|
import { getProvider } from '@depay/web3-client'
|
|
420
|
-
import
|
|
404
|
+
import Token from '@depay/web3-tokens'
|
|
421
405
|
import { PublicKey, SystemProgram, Keypair } from '@depay/solana-web3.js'
|
|
422
406
|
|
|
423
407
|
const wallets = await getWallets()
|
package/dist/esm/index.evm.js
CHANGED
|
@@ -42210,12 +42210,19 @@ class Transaction {
|
|
|
42210
42210
|
async getData() {
|
|
42211
42211
|
let contractArguments = this.getContractArguments();
|
|
42212
42212
|
let populatedTransaction;
|
|
42213
|
+
let method = this.method;
|
|
42214
|
+
if(this.getContract()[method] === undefined){
|
|
42215
|
+
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
42216
|
+
return fragment.name == this.method
|
|
42217
|
+
});
|
|
42218
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
42219
|
+
}
|
|
42213
42220
|
if(contractArguments) {
|
|
42214
|
-
populatedTransaction = await this.getContract().populateTransaction[
|
|
42221
|
+
populatedTransaction = await this.getContract().populateTransaction[method].apply(
|
|
42215
42222
|
null, contractArguments
|
|
42216
42223
|
);
|
|
42217
42224
|
} else {
|
|
42218
|
-
populatedTransaction = await this.getContract().populateTransaction[
|
|
42225
|
+
populatedTransaction = await this.getContract().populateTransaction[method].apply(null);
|
|
42219
42226
|
}
|
|
42220
42227
|
|
|
42221
42228
|
return populatedTransaction.data
|
|
@@ -42363,8 +42370,8 @@ const submitInstructions = async ({ transaction, wallet })=> {
|
|
|
42363
42370
|
return wallet._sendTransaction(transactionV0)
|
|
42364
42371
|
};
|
|
42365
42372
|
|
|
42366
|
-
let supported$2 = ['ethereum', 'bsc', 'polygon', 'fantom', '
|
|
42367
|
-
supported$2.evm = ['ethereum', 'bsc', 'polygon', 'fantom', '
|
|
42373
|
+
let supported$2 = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
42374
|
+
supported$2.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
42368
42375
|
supported$2.solana = [];
|
|
42369
42376
|
|
|
42370
42377
|
function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
@@ -42728,35 +42735,39 @@ class StaticJsonRpcSequentialProvider extends Connection {
|
|
|
42728
42735
|
|
|
42729
42736
|
const batch = chunk.map((inflight) => inflight.request);
|
|
42730
42737
|
|
|
42731
|
-
|
|
42732
|
-
|
|
42733
|
-
|
|
42734
|
-
|
|
42735
|
-
|
|
42736
|
-
|
|
42737
|
-
|
|
42738
|
-
|
|
42739
|
-
|
|
42740
|
-
|
|
42741
|
-
|
|
42742
|
-
} else {
|
|
42743
|
-
inflightRequest.resolve(payload);
|
|
42744
|
-
}
|
|
42738
|
+
const handleError = (error)=>{
|
|
42739
|
+
if(error && [
|
|
42740
|
+
'Failed to fetch', 'limit reached', '504', '503', '502', '500', '429', '426', '422', '413', '409', '408', '406', '405', '404', '403', '402', '401', '400'
|
|
42741
|
+
].some((errorType)=>error.toString().match(errorType))) {
|
|
42742
|
+
const index = this._endpoints.indexOf(this._endpoint)+1;
|
|
42743
|
+
this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index];
|
|
42744
|
+
this._provider = new Connection(this._endpoint);
|
|
42745
|
+
this.requestChunk(chunk);
|
|
42746
|
+
} else {
|
|
42747
|
+
chunk.forEach((inflightRequest) => {
|
|
42748
|
+
inflightRequest.reject(error);
|
|
42745
42749
|
});
|
|
42746
|
-
}
|
|
42747
|
-
|
|
42748
|
-
|
|
42749
|
-
|
|
42750
|
-
|
|
42751
|
-
|
|
42752
|
-
|
|
42753
|
-
|
|
42754
|
-
|
|
42755
|
-
|
|
42756
|
-
|
|
42750
|
+
}
|
|
42751
|
+
};
|
|
42752
|
+
|
|
42753
|
+
try {
|
|
42754
|
+
return this._provider._rpcBatchRequest(batch)
|
|
42755
|
+
.then((result) => {
|
|
42756
|
+
// For each result, feed it to the correct Promise, depending
|
|
42757
|
+
// on whether it was a success or error
|
|
42758
|
+
chunk.forEach((inflightRequest, index) => {
|
|
42759
|
+
const payload = result[index];
|
|
42760
|
+
if (payload.error) {
|
|
42761
|
+
const error = new Error(payload.error.message);
|
|
42762
|
+
error.code = payload.error.code;
|
|
42763
|
+
error.data = payload.error.data;
|
|
42764
|
+
inflightRequest.reject(error);
|
|
42765
|
+
} else {
|
|
42766
|
+
inflightRequest.resolve(payload);
|
|
42767
|
+
}
|
|
42757
42768
|
});
|
|
42758
|
-
}
|
|
42759
|
-
|
|
42769
|
+
}).catch(handleError)
|
|
42770
|
+
} catch (error){ return handleError(error) }
|
|
42760
42771
|
}
|
|
42761
42772
|
|
|
42762
42773
|
_rpcRequestReplacement(methodName, args) {
|
|
@@ -42909,8 +42920,8 @@ var Solana = {
|
|
|
42909
42920
|
setProvider: setProvider$1,
|
|
42910
42921
|
};
|
|
42911
42922
|
|
|
42912
|
-
let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', '
|
|
42913
|
-
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', '
|
|
42923
|
+
let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
42924
|
+
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
42914
42925
|
supported$1.solana = ['solana'];
|
|
42915
42926
|
|
|
42916
42927
|
function _optionalChain$1$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
@@ -43026,9 +43037,17 @@ let paramsToContractArgs = ({ contract, method, params }) => {
|
|
|
43026
43037
|
};
|
|
43027
43038
|
|
|
43028
43039
|
const contractCall = ({ address, api, method, params, provider, block }) => {
|
|
43029
|
-
|
|
43030
|
-
|
|
43031
|
-
|
|
43040
|
+
const contract = new ethers.Contract(address, api, provider);
|
|
43041
|
+
const args = paramsToContractArgs({ contract, method, params });
|
|
43042
|
+
const fragment = contract.interface.fragments.find((fragment)=>fragment.name === method);
|
|
43043
|
+
if(contract[method] === undefined) {
|
|
43044
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
43045
|
+
}
|
|
43046
|
+
if(fragment && fragment.stateMutability === 'nonpayable') {
|
|
43047
|
+
return contract.callStatic[method](...args, { blockTag: block })
|
|
43048
|
+
} else {
|
|
43049
|
+
return contract[method](...args, { blockTag: block })
|
|
43050
|
+
}
|
|
43032
43051
|
};
|
|
43033
43052
|
|
|
43034
43053
|
const balance$1 = ({ address, provider }) => {
|
|
@@ -43058,17 +43077,25 @@ var requestEVM = async ({ blockchain, address, api, method, params, block, timeo
|
|
|
43058
43077
|
|
|
43059
43078
|
if(strategy === 'fastest') {
|
|
43060
43079
|
|
|
43061
|
-
|
|
43080
|
+
const providers = await EVM.getProviders(blockchain);
|
|
43081
|
+
|
|
43082
|
+
let allRequestsFailed = [];
|
|
43062
43083
|
|
|
43063
|
-
|
|
43084
|
+
const allRequestsInParallel = providers.map((provider)=>{
|
|
43085
|
+
return new Promise((resolve)=>{
|
|
43086
|
+
allRequestsFailed.push(
|
|
43087
|
+
singleRequest$1({ blockchain, address, api, method, params, block, provider }).then(resolve)
|
|
43088
|
+
);
|
|
43089
|
+
})
|
|
43090
|
+
});
|
|
43064
43091
|
|
|
43065
|
-
|
|
43066
|
-
|
|
43067
|
-
|
|
43068
|
-
|
|
43069
|
-
|
|
43070
|
-
|
|
43071
|
-
|
|
43092
|
+
const timeoutPromise = new Promise((_, reject)=>setTimeout(()=>{ reject(new Error("Web3ClientTimeout")); }, timeout || 10000));
|
|
43093
|
+
|
|
43094
|
+
allRequestsFailed = Promise.all(allRequestsFailed.map((request)=>{
|
|
43095
|
+
return new Promise((resolve)=>{ request.catch(resolve); })
|
|
43096
|
+
})).then(()=>{ return });
|
|
43097
|
+
|
|
43098
|
+
return Promise.race([...allRequestsInParallel, timeoutPromise, allRequestsFailed])
|
|
43072
43099
|
|
|
43073
43100
|
} else { // failover
|
|
43074
43101
|
|
|
@@ -43086,6 +43113,7 @@ var requestEVM = async ({ blockchain, address, api, method, params, block, timeo
|
|
|
43086
43113
|
|
|
43087
43114
|
const accountInfo = async ({ address, api, method, params, provider, block }) => {
|
|
43088
43115
|
const info = await provider.getAccountInfo(new PublicKey$1(address));
|
|
43116
|
+
if(!info || !info.data) { return }
|
|
43089
43117
|
return api.decode(info.data)
|
|
43090
43118
|
};
|
|
43091
43119
|
|
|
@@ -43116,14 +43144,14 @@ const singleRequest = async({ blockchain, address, api, method, params, block, p
|
|
|
43116
43144
|
} else if(method === 'getTokenAccountBalance') {
|
|
43117
43145
|
return await provider.getTokenAccountBalance(new PublicKey$1(address))
|
|
43118
43146
|
} else if (method === 'latestBlockNumber') {
|
|
43119
|
-
return await provider.
|
|
43147
|
+
return await provider.getSlot(params ? params : undefined)
|
|
43120
43148
|
} else if (method === 'balance') {
|
|
43121
43149
|
return await balance({ address, provider })
|
|
43122
43150
|
}
|
|
43123
43151
|
|
|
43124
43152
|
} catch (error){
|
|
43125
43153
|
if(providers && error && [
|
|
43126
|
-
'Failed to fetch', '504', '503', '502', '500', '429', '426', '422', '413', '409', '408', '406', '405', '404', '403', '402', '401', '400'
|
|
43154
|
+
'Failed to fetch', 'limit reached', '504', '503', '502', '500', '429', '426', '422', '413', '409', '408', '406', '405', '404', '403', '402', '401', '400'
|
|
43127
43155
|
].some((errorType)=>error.toString().match(errorType))) {
|
|
43128
43156
|
let nextProvider = providers[providers.indexOf(provider)+1] || providers[0];
|
|
43129
43157
|
return singleRequest({ blockchain, address, api, method, params, block, provider: nextProvider, providers })
|
|
@@ -43142,17 +43170,24 @@ var requestSolana = async ({ blockchain, address, api, method, params, block, ti
|
|
|
43142
43170
|
|
|
43143
43171
|
if(strategy === 'fastest') {
|
|
43144
43172
|
|
|
43145
|
-
|
|
43173
|
+
let allRequestsFailed = [];
|
|
43146
43174
|
|
|
43147
|
-
|
|
43148
|
-
|
|
43149
|
-
|
|
43150
|
-
|
|
43151
|
-
|
|
43152
|
-
|
|
43153
|
-
|
|
43154
|
-
}))
|
|
43175
|
+
const allRequestsInParallel = providers.map((provider)=>{
|
|
43176
|
+
return new Promise((resolve)=>{
|
|
43177
|
+
allRequestsFailed.push(
|
|
43178
|
+
singleRequest({ blockchain, address, api, method, params, block, provider }).then(resolve)
|
|
43179
|
+
);
|
|
43180
|
+
})
|
|
43181
|
+
});
|
|
43155
43182
|
|
|
43183
|
+
const timeoutPromise = new Promise((_, reject)=>setTimeout(()=>{ reject(new Error("Web3ClientTimeout")); }, timeout || 10000));
|
|
43184
|
+
|
|
43185
|
+
allRequestsFailed = Promise.all(allRequestsFailed.map((request)=>{
|
|
43186
|
+
return new Promise((resolve)=>{ request.catch(resolve); })
|
|
43187
|
+
})).then(()=>{ return });
|
|
43188
|
+
|
|
43189
|
+
return Promise.race([...allRequestsInParallel, timeoutPromise, allRequestsFailed])
|
|
43190
|
+
|
|
43156
43191
|
} else { // failover
|
|
43157
43192
|
|
|
43158
43193
|
const provider = await Solana.getProvider(blockchain);
|
|
@@ -43197,11 +43232,11 @@ var parseUrl = (url) => {
|
|
|
43197
43232
|
const request = async function (url, options) {
|
|
43198
43233
|
|
|
43199
43234
|
const { blockchain, address, method } = parseUrl(url);
|
|
43200
|
-
const { api, params, cache: cache$1, block, timeout, strategy } = (typeof(url) == 'object' ? url : options) || {};
|
|
43235
|
+
const { api, params, cache: cache$1, block, timeout, strategy, cacheKey } = (typeof(url) == 'object' ? url : options) || {};
|
|
43201
43236
|
|
|
43202
43237
|
return await cache({
|
|
43203
43238
|
expires: cache$1 || 0,
|
|
43204
|
-
key: [blockchain, address, method, params, block],
|
|
43239
|
+
key: cacheKey || [blockchain, address, method, params, block],
|
|
43205
43240
|
call: async()=>{
|
|
43206
43241
|
if(supported$1.evm.includes(blockchain)) {
|
|
43207
43242
|
|
|
@@ -43309,7 +43344,14 @@ const submit$2 = ({ transaction, provider, signer }) => {
|
|
|
43309
43344
|
const submitContractInteraction$2 = ({ transaction, signer, provider })=>{
|
|
43310
43345
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
43311
43346
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
43312
|
-
let method =
|
|
43347
|
+
let method = transaction.method;
|
|
43348
|
+
if(contract[method] === undefined){
|
|
43349
|
+
let fragment = contract.interface.fragments.find((fragment) => {
|
|
43350
|
+
return fragment.name == transaction.method
|
|
43351
|
+
});
|
|
43352
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
43353
|
+
}
|
|
43354
|
+
method = contract.connect(signer)[method];
|
|
43313
43355
|
if(contractArguments) {
|
|
43314
43356
|
return method(...contractArguments, {
|
|
43315
43357
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
@@ -43588,7 +43630,7 @@ class Phantom extends WindowSolana {
|
|
|
43588
43630
|
|
|
43589
43631
|
static __initStatic() {this.info = {
|
|
43590
43632
|
name: 'Phantom',
|
|
43591
|
-
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI3LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxMjggMTI4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxMjggMTI4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+
|
|
43633
|
+
logo: 'data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sNTYuNyw3NS41LDUzLjcsNzUuNSw0OS41eiBNOTMuMiw0OS41YzAtNC4xLDIuMy03LjEsNS43LTcuMWMzLjMsMCw1LjYsMi45LDUuNiw3LjEKCWMwLDQuMS0yLjMsNy4xLTUuNiw3LjFDOTUuNSw1Ni43LDkzLjIsNTMuNyw5My4yLDQ5LjV6Ii8+Cjwvc3ZnPgo=',
|
|
43592
43634
|
blockchains: ['solana']
|
|
43593
43635
|
};}
|
|
43594
43636
|
|
|
@@ -44327,7 +44369,14 @@ const submit = ({ transaction, provider, signer }) => {
|
|
|
44327
44369
|
const submitContractInteraction = ({ transaction, signer, provider })=>{
|
|
44328
44370
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
44329
44371
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
44330
|
-
let method =
|
|
44372
|
+
let method = transaction.method;
|
|
44373
|
+
if(contract[method] === undefined){
|
|
44374
|
+
let fragment = contract.interface.fragments.find((fragment) => {
|
|
44375
|
+
return fragment.name == transaction.method
|
|
44376
|
+
});
|
|
44377
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
44378
|
+
}
|
|
44379
|
+
method = contract.connect(signer)[method];
|
|
44331
44380
|
if(contractArguments) {
|
|
44332
44381
|
return method(...contractArguments, {
|
|
44333
44382
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
package/dist/esm/index.js
CHANGED
|
@@ -81,12 +81,19 @@ class Transaction {
|
|
|
81
81
|
async getData() {
|
|
82
82
|
let contractArguments = this.getContractArguments();
|
|
83
83
|
let populatedTransaction;
|
|
84
|
+
let method = this.method;
|
|
85
|
+
if(this.getContract()[method] === undefined){
|
|
86
|
+
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
87
|
+
return fragment.name == this.method
|
|
88
|
+
});
|
|
89
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
90
|
+
}
|
|
84
91
|
if(contractArguments) {
|
|
85
|
-
populatedTransaction = await this.getContract().populateTransaction[
|
|
92
|
+
populatedTransaction = await this.getContract().populateTransaction[method].apply(
|
|
86
93
|
null, contractArguments
|
|
87
94
|
);
|
|
88
95
|
} else {
|
|
89
|
-
populatedTransaction = await this.getContract().populateTransaction[
|
|
96
|
+
populatedTransaction = await this.getContract().populateTransaction[method].apply(null);
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
return populatedTransaction.data
|
|
@@ -234,8 +241,8 @@ const submitInstructions = async ({ transaction, wallet })=> {
|
|
|
234
241
|
return wallet._sendTransaction(transactionV0)
|
|
235
242
|
};
|
|
236
243
|
|
|
237
|
-
let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', '
|
|
238
|
-
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', '
|
|
244
|
+
let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
245
|
+
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
|
|
239
246
|
supported$1.solana = ['solana'];
|
|
240
247
|
|
|
241
248
|
function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
@@ -439,7 +446,14 @@ const submit$2 = ({ transaction, provider, signer }) => {
|
|
|
439
446
|
const submitContractInteraction$2 = ({ transaction, signer, provider })=>{
|
|
440
447
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
441
448
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
442
|
-
let method =
|
|
449
|
+
let method = transaction.method;
|
|
450
|
+
if(contract[method] === undefined){
|
|
451
|
+
let fragment = contract.interface.fragments.find((fragment) => {
|
|
452
|
+
return fragment.name == transaction.method
|
|
453
|
+
});
|
|
454
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
455
|
+
}
|
|
456
|
+
method = contract.connect(signer)[method];
|
|
443
457
|
if(contractArguments) {
|
|
444
458
|
return method(...contractArguments, {
|
|
445
459
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
@@ -718,7 +732,7 @@ class Phantom extends WindowSolana {
|
|
|
718
732
|
|
|
719
733
|
static __initStatic() {this.info = {
|
|
720
734
|
name: 'Phantom',
|
|
721
|
-
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI3LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxMjggMTI4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxMjggMTI4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+
|
|
735
|
+
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI3LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIF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LjIsNTMuNyw5My4yLDQ5LjV6Ii8+Cjwvc3ZnPgo=',
|
|
722
736
|
blockchains: ['solana']
|
|
723
737
|
};}
|
|
724
738
|
|
|
@@ -1459,7 +1473,14 @@ const submit = ({ transaction, provider, signer }) => {
|
|
|
1459
1473
|
const submitContractInteraction = ({ transaction, signer, provider })=>{
|
|
1460
1474
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
1461
1475
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
1462
|
-
let method =
|
|
1476
|
+
let method = transaction.method;
|
|
1477
|
+
if(contract[method] === undefined){
|
|
1478
|
+
let fragment = contract.interface.fragments.find((fragment) => {
|
|
1479
|
+
return fragment.name == transaction.method
|
|
1480
|
+
});
|
|
1481
|
+
method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
|
|
1482
|
+
}
|
|
1483
|
+
method = contract.connect(signer)[method];
|
|
1463
1484
|
if(contractArguments) {
|
|
1464
1485
|
return method(...contractArguments, {
|
|
1465
1486
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|