MCPcopy Create free account
hub / github.com/cardstack/cardstack / executeSend

Function executeSend

packages/cardpay-sdk/sdk/utils/safe-utils.ts:168–199  ·  view source on GitHub ↗
(
  web3: Web3,
  prepaidCardAddress: string,
  spendAmount: number,
  rate: string,
  action: string,
  data: string,
  signatures: Signature[],
  nonce: string
)

Source from the content-addressed store, hash-verified

166}
167
168export async function executeSend(
169 web3: Web3,
170 prepaidCardAddress: string,
171 spendAmount: number,
172 rate: string,
173 action: string,
174 data: string,
175 signatures: Signature[],
176 nonce: string
177): Promise<GnosisExecTx> {
178 let relayServiceURL = await getConstant('relayServiceURL', web3);
179 const url = `${relayServiceURL}/v1/prepaid-card/${prepaidCardAddress}/send/`;
180 const options = {
181 method: 'POST',
182 headers: {
183 'Content-Type': 'application/json', //eslint-disable-line @typescript-eslint/naming-convention
184 },
185 body: JSON.stringify({
186 nonce,
187 payment: spendAmount,
188 rate,
189 action,
190 data,
191 signatures,
192 }),
193 };
194 let response = await fetch(url, options);
195 if (!response?.ok) {
196 throw new Error(await response.text());
197 }
198 return response.json();
199}
200
201export function getParamsFromEvent(web3: Web3, txnReceipt: TransactionReceipt, eventAbi: EventABI, address: string) {
202 let eventParams = txnReceipt.logs

Callers 4

executePayMerchantMethod · 0.90
executeSplitMethod · 0.90
executeTransferMethod · 0.90

Calls 1

getConstantFunction · 0.90

Tested by

no test coverage detected