Skip to content

Commit

Permalink
fix: resolvers for relay module
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowardx committed Dec 13, 2024
1 parent 76d61c9 commit e689b17
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/simple-dapp/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ addCb.onclick = () => {
const dAppToolkit = RadixDappToolkit({
dAppDefinitionAddress,
networkId,
logger,
// logger,
})

const gatewayApi = GatewayApiClient.initialize(
Expand Down Expand Up @@ -241,10 +241,12 @@ sendTxButton.onclick = async () => {
console.log('send tx result', res)
}

oneTimeRequest.onclick = () => {
dAppToolkit.walletApi.sendOneTimeRequest(
oneTimeRequest.onclick = async () => {
const res = await dAppToolkit.walletApi.sendOneTimeRequest(
OneTimeDataRequestBuilder.accounts().exactly(1),
)

console.log('one time request result', res)
}

proofOfOwnershipRequest.onclick = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ export const RequestItemModule = (input: RequestItemModuleInput) => {
transactionIntentHash,
metadata = {},
walletData,
walletResponse,
}: {
id: string
status: RequestStatusTypes
error?: string
transactionIntentHash?: string
walletData?: WalletData
walletResponse?: any,
metadata?: Record<string, string | number | boolean>
}): ResultAsync<void, { reason: string }> => {
return storageModule
Expand All @@ -123,6 +125,7 @@ export const RequestItemModule = (input: RequestItemModuleInput) => {
walletData,
transactionIntentHash,
error,
walletResponse,
status:
item.status === RequestStatus.ignored ? item.status : status,
metadata: item.metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const dataResponseResolver =
id: walletInteraction.interactionId,
status: 'success',
walletData,
walletResponse: walletInteractionResponse,
})
.mapErr((error) =>
SdkError(error.reason, walletInteraction.interactionId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const failedResponseResolver =
.updateStatus({
id: interactionId,
status: 'fail',
walletResponse: walletInteractionResponse,
})
.orElse((error) => {
dependencies.updateConnectButtonStatus('fail')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const preAuthorizationResponseResolver =
id: interactionId,
status: RequestStatus.pendingCommit,
transactionIntentHash: subintentHash,
walletResponse: walletInteractionResponse,
metadata: {
signedPartialTransaction,
expirationTimestamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const sendTransactionResponseResolver =
status: requestItemStatus,
transactionIntentHash,
metadata: { transactionStatus: status },
walletResponse: walletInteractionResponse,
})
.orElse((error) => err(SdkError(error.reason, interactionId)))
.andThen(() => {
Expand Down

0 comments on commit e689b17

Please sign in to comment.