UNPKG

@0xfutbol/id

Version:

React component library with shared providers for 0xFutbol ID

52 lines (51 loc) 2.35 kB
import {bk as addTransactionToStore}from'./index-BJCJzM2_.js';import'react';import'react/jsx-runtime';import'@0xfutbol/id-sign';import'react-use';import'@0xfutbol/constants';import'thirdweb';import'@matchain/matchid-sdk-react';import'@tanstack/react-query';import'@matchain/matchid-sdk-react/index.css';import'react-dom';async function sendGaslessTransaction({ account, transaction, serializableTransaction, gasless, }) { // TODO: handle special case for mutlicall transactions! // Steps: // 1. check if the method is `multicall` by comparing the 4bytes data with the `multicall` selector // 2. split the rest of the data into its "parts" // 3. solidityPack the parts with the part data + the `account.address` // see v4: `core/classes/transactions.ts>Transaction>prepareGasless:L551` if (serializableTransaction.value && serializableTransaction.value > 0n) { throw new Error("Gasless transactions cannot have a value"); } // TODO: multiply gas by 2 for some reason(?) - we do in v4, *should* we? let result; // biconomy if (gasless.provider === "biconomy") { const { relayBiconomyTransaction } = await import('./biconomy-dlJF9OCy.js'); result = await relayBiconomyTransaction({ account, transaction, serializableTransaction, gasless, }); } // openzeppelin if (gasless.provider === "openzeppelin") { const { relayOpenZeppelinTransaction } = await import('./openzeppelin-BzsaK6ke.js'); result = await relayOpenZeppelinTransaction({ account, transaction, serializableTransaction, gasless, }); } if (gasless.provider === "engine") { const { relayEngineTransaction } = await import('./engine-Bw5mhy2c.js'); result = await relayEngineTransaction({ account, transaction, serializableTransaction, gasless, }); } if (!result) { throw new Error("Unsupported gasless provider"); } addTransactionToStore({ address: account.address, transactionHash: result.transactionHash, chainId: transaction.chain.id, }); return result; }export{sendGaslessTransaction};//# sourceMappingURL=send-gasless-transaction-DpF3S3VG.js.map