Creating Transactions
In the React Demo Application, we perform typed message signing for Goerli ETH. The transaction values are hard-coded in the Backend Server Demo application, so you can customize these values by updating the transaction controller in the backend server.
The front-end application calls the relevant endpoint to initiate the transaction process.
...
createTransaction: async () => {
if (!apiService) {
throw new Error("apiService is not initialized");
}
const { deviceId } = get();
const newTxData = await apiService.createTransaction(deviceId);
const txs = updateOrAddTx(get().txs, newTxData);
set((state) => ({ ...state, txs }));
}
...
...
public async createTransaction(deviceId: string): Promise<ITransactionData> {
const createTxResponse = await this._postCall(`api/devices/${deviceId}/transactions`);
return createTxResponse;
}
...
Updated 10 months ago