( web3: Web3, prepaidCardAddress: string, spendAmount: number, rate: string, action: string, data: string )
| 93 | } |
| 94 | |
| 95 | export async function getSendPayload( |
| 96 | web3: Web3, |
| 97 | prepaidCardAddress: string, |
| 98 | spendAmount: number, |
| 99 | rate: string, |
| 100 | action: string, |
| 101 | data: string |
| 102 | ): Promise<SendPayload> { |
| 103 | let relayServiceURL = await getConstant('relayServiceURL', web3); |
| 104 | let url = `${relayServiceURL}/v1/prepaid-card/${prepaidCardAddress}/send/get-params/`; |
| 105 | let options = { |
| 106 | method: 'POST', |
| 107 | headers: { |
| 108 | 'Content-Type': 'application/json', //eslint-disable-line @typescript-eslint/naming-convention |
| 109 | }, |
| 110 | body: JSON.stringify({ |
| 111 | payment: spendAmount, |
| 112 | rate, |
| 113 | action, |
| 114 | data, |
| 115 | }), |
| 116 | }; |
| 117 | let response = await fetch(url, options); |
| 118 | if (!response?.ok) { |
| 119 | throw new Error(await response.text()); |
| 120 | } |
| 121 | return await response.json(); |
| 122 | } |
| 123 | |
| 124 | export async function executeTransaction( |
| 125 | web3: Web3, |
no test coverage detected