diff --git a/client-sdk/ts-web/rt/src/callformat.ts b/client-sdk/ts-web/rt/src/callformat.ts index 793721f231..29e3554b98 100644 --- a/client-sdk/ts-web/rt/src/callformat.ts +++ b/client-sdk/ts-web/rt/src/callformat.ts @@ -32,14 +32,14 @@ export interface MetaEncryptedX25519DeoxysII { * encodeCallWithNonceAndKeys encodes a call based on its configured call format. * It returns the encoded call and any metadata needed to successfully decode the result. */ -export function encodeCallWithNonceAndKeys( +export async function encodeCallWithNonceAndKeys( nonce: Uint8Array, sk: Uint8Array, pk: Uint8Array, call: types.Call, format: types.CallFormat, config?: EncodeConfig, -): [types.Call, unknown] { +): Promise<[types.Call, unknown]> { switch (format) { case transaction.CALLFORMAT_PLAIN: return [call, undefined]; @@ -80,15 +80,15 @@ export function encodeCallWithNonceAndKeys( * encodeCall randomly generates nonce and keyPair and then call encodeCallWithNonceAndKeys * It returns the encoded call and any metadata needed to successfully decode the result. */ -export function encodeCall( +export async function encodeCall( call: types.Call, format: types.CallFormat, config?: EncodeConfig, -): [types.Call, unknown] { +): Promise<[types.Call, unknown]> { const nonce = new Uint8Array(deoxysii.NonceSize); crypto.getRandomValues(nonce); const keyPair = nacl.box.keyPair(); - return encodeCallWithNonceAndKeys( + return await encodeCallWithNonceAndKeys( nonce, keyPair.secretKey, keyPair.publicKey, @@ -101,11 +101,11 @@ export function encodeCall( /** * decodeResult performs result decoding based on the specified call format metadata. */ -export function decodeResult( +export async function decodeResult( result: types.CallResult, format: types.CallFormat, meta?: MetaEncryptedX25519DeoxysII, -): types.CallResult { +): Promise { switch (format) { case transaction.CALLFORMAT_PLAIN: // In case of plain-text data format, we simply pass on the result unchanged.