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

Function executeTransaction

packages/cardpay-sdk/sdk/utils/safe-utils.ts:124–166  ·  view source on GitHub ↗
(
  web3: Web3,
  from: string,
  to: string,
  value: number,
  data: any,
  operation: number,
  safeTxGas: string,
  dataGas: string,
  gasPrice: string,
  nonce: string,
  signatures: any,
  gasToken: string,
  refundReceiver: string
)

Source from the content-addressed store, hash-verified

122}
123
124export async function executeTransaction(
125 web3: Web3,
126 from: string,
127 to: string,
128 value: number,
129 data: any,
130 operation: number,
131 safeTxGas: string,
132 dataGas: string,
133 gasPrice: string,
134 nonce: string,
135 signatures: any,
136 gasToken: string,
137 refundReceiver: string
138): Promise<GnosisExecTx> {
139 let relayServiceURL = await getConstant('relayServiceURL', web3);
140 const url = `${relayServiceURL}/v1/safes/${from}/transactions/`;
141 const options = {
142 method: 'POST',
143 headers: {
144 'Content-Type': 'application/json', //eslint-disable-line @typescript-eslint/naming-convention
145 },
146 body: JSON.stringify({
147 to,
148 value,
149 data,
150 operation,
151 safeTxGas,
152 baseGas: dataGas,
153 dataGas,
154 gasPrice,
155 nonce,
156 signatures,
157 gasToken,
158 refundReceiver,
159 }),
160 };
161 let response = await fetch(url, options);
162 if (!response?.ok) {
163 throw new Error(await response.text());
164 }
165 return response.json();
166}
167
168export async function executeSend(
169 web3: Web3,

Callers 5

relayTokensMethod · 0.90
createMethod · 0.90
claimMethod · 0.90
sendTokensMethod · 0.90
setSupplierInfoDIDMethod · 0.90

Calls 1

getConstantFunction · 0.90

Tested by

no test coverage detected