Skip to content

Commit

Permalink
Merge branch 'cg-soroban-sc-val-by-type-2' into cg-soroban-gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
CassioMG committed Mar 29, 2024
2 parents d96497d + 511cd91 commit 96a1c40
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { StrKey, scValToNative, xdr } from "@stellar/stellar-sdk";

/* eslint-disable jsdoc/require-returns-type */
/**
* This function attempts to convert smart contract (complex) value types
* to common/simpler types like string, array, buffer, JSON string, etc.
*
* @param {xdr.ScVal} scVal the smart contract (complex) value
*
* @returns {any} the smart contract value converted to a common/simpler
*
* @returns the smart contract value converted to a common/simpler
* value like string, array, buffer, JSON string, etc.
*
* @example
Expand All @@ -20,8 +22,7 @@ import { StrKey, scValToNative, xdr } from "@stellar/stellar-sdk";
*
* scValByType(accountAddress) returns "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const scValByType = (scVal: xdr.ScVal): any => {
export const scValByType = (scVal: xdr.ScVal) => {
switch (scVal.switch()) {
case xdr.ScValType.scvAddress(): {
const address = scVal.address();
Expand Down Expand Up @@ -90,10 +91,6 @@ export const scValByType = (scVal: xdr.ScVal): any => {
return native;
}

case xdr.ScValType.scvVoid(): {
return null;
}

default:
return null;
}
Expand Down

0 comments on commit 96a1c40

Please sign in to comment.