Skip to content

Commit

Permalink
Merge pull request #194 from radixdlt/add-send-tx
Browse files Browse the repository at this point in the history
feat: add "send tx" button
  • Loading branch information
dawidsowardx authored May 9, 2024
2 parents 1b0a11e + fcc6a5b commit 80ae4fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
17 changes: 17 additions & 0 deletions examples/simple-dapp/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const content = document.getElementById('app')!

content.innerHTML = `
<button id="reset">Reset</button>
<button id="sendTx">Send Tx</button>
<div class="mt-25"><button id="one-time-request">Send one time request</button></div>
Expand All @@ -39,6 +40,7 @@ content.innerHTML = `
<pre id="logs"></pre>
`
const resetButton = document.getElementById('reset')!
const sendTxButton = document.getElementById('sendTx')!
const sessions = document.getElementById('sessions')!
const requests = document.getElementById('requests')!
const logs = document.getElementById('logs')!
Expand Down Expand Up @@ -94,6 +96,21 @@ resetButton.onclick = () => {
window.location.replace(window.location.origin)
}

sendTxButton.onclick = () => {
dAppToolkit.walletApi.sendTransaction({
transactionManifest: `CALL_METHOD
Address("component_tdx_2_1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxyulkzl")
"free"
;
CALL_METHOD
Address("account_tdx_2_12yfw30hdc445j4lnepw7dmrkjcqcswsrxlff5r07mrjq9f8mnnn2r5")
"try_deposit_batch_or_abort"
Expression("ENTIRE_WORKTOP")
Enum<0u8>()
;`,
})
}

oneTimeRequest.onclick = () => {
dAppToolkit.walletApi.sendOneTimeRequest(
OneTimeDataRequestBuilder.accounts().exactly(1),
Expand Down
6 changes: 1 addition & 5 deletions packages/dapp-toolkit/src/modules/gateway/gateway.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import {
ExponentialBackoff,
} from '../../helpers'
import { SdkError } from '../../error'
import {
RadixNetworkConfigById,
TransactionStatus,
TransactionStatusResponse,
} from './types'
import { TransactionStatus, TransactionStatusResponse } from './types'
import { GatewayApiClientConfig } from '../../_types'

export type GatewayModule = ReturnType<typeof GatewayModule>
Expand Down

0 comments on commit 80ae4fe

Please sign in to comment.