Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
chore: update examples
Browse files Browse the repository at this point in the history
Add input to specify number of oneTimeAddresses
  • Loading branch information
xstelea committed Nov 29, 2022
1 parent 91b1399 commit 9d12c5a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
</head>
<body>
<script type="module" src="/index.ts"></script>
<button id="account-address-btn">Get account addresses</button>
<div>
<input id="account-address-input" type="number" value="3" />
<button id="account-address-btn">Get account addresses</button>
</div>
<button id="persona-data-btn">Get persona data</button>
<button id="login-btn">Login</button>
<button id="send-tx-btn">Send SignTX Request</button>
Expand Down
16 changes: 15 additions & 1 deletion examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const displayResults = (result: Result<any, any>) => {
const clearResults = () => {
document.getElementById('results')!.innerHTML = ``
}
const accountAddressInputElement = document.getElementById(
'account-address-input'
)! as HTMLInputElement

document.getElementById('login-btn')!.onclick = async () => {
clearResults()
Expand All @@ -63,9 +66,13 @@ document.getElementById('login-btn')!.onclick = async () => {
document.getElementById('account-address-btn')!.onclick = async () => {
clearResults()

const value = accountAddressInputElement.value

const result = await sdk.request(
requestBuilder(
requestItem.oneTimeAccountAddresses.withoutProofOfOwnership()
requestItem.oneTimeAccountAddresses.withoutProofOfOwnership(
parseInt(value, 10)
)
)
)

Expand All @@ -92,3 +99,10 @@ document.getElementById('send-tx-btn')!.onclick = async () => {

displayResults(result)
}

sdk.request(
requestBuilder(
requestItem.usePersona('abc'),
requestItem.ongoingAccountAddresses.withoutProofOfOwnership()
)
)

0 comments on commit 9d12c5a

Please sign in to comment.