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

Commit

Permalink
feat: add arbitrary data parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowardx committed Jan 16, 2024
1 parent d274c26 commit 79dbddc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
6 changes: 5 additions & 1 deletion lib/IO/wallet-interaction-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ export const walletInteractionFactory =
(
metadata: Metadata,
items: WalletInteractionItems,
interactionId = crypto.randomUUID()
interactionId = crypto.randomUUID(),
arbitraryData: any = {}
// arbitraryData: WalletInteractionArbitraryData = {}
// eslint-disable-next-line max-params
): ResultAsync<WalletInteraction, SdkError> => {
const walletInteraction = {
items,
interactionId,
metadata,
arbitraryData,
}
return parseAsync(WalletInteraction, walletInteraction).mapErr((issues) => {
logger?.error(`🔵⬆️❌ invalidWalletInteraction`, issues)
Expand Down
23 changes: 16 additions & 7 deletions lib/create-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ export const createMethods = (

const request = (
items: WalletRequestItems,
callbackFns: Partial<CallbackFns> = {}
callbackFns: Partial<CallbackFns> = {},
arbitraryData: any = {}
// TODO: arbitraryData: WalletInteractionArbitraryData = {}
) =>
createWalletInteraction(input, items)
createWalletInteraction(input, items, undefined, arbitraryData)
.andThen((walletInteraction) =>
connectorExtensionClient.send(walletInteraction, callbackFns)
)
Expand All @@ -33,12 +35,19 @@ export const createMethods = (

const sendTransaction = (
items: SendTransactionItem,
callbackFns: Partial<CallbackFns> = {}
callbackFns: Partial<CallbackFns> = {},
arbitraryData: any = {}
// TODO: arbitraryData: WalletInteractionArbitraryData = {}
) =>
createWalletInteraction(input, {
discriminator: 'transaction',
send: items,
})
createWalletInteraction(
input,
{
discriminator: 'transaction',
send: items,
},
undefined,
arbitraryData
)
.andThen((walletInteraction) =>
connectorExtensionClient.send(walletInteraction, callbackFns)
)
Expand Down

0 comments on commit 79dbddc

Please sign in to comment.