Skip to main content

Function: userRef()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / userRef

Function: userRef()

userRef(value, field): string

Defined in: packages/gswap-sdk/dist/index.d.ts:4453

The GalaChain user reference an owner, user or wallet address names, in the one spelling the gateway and the swap backend accept: eth|<EIP-55 checksummed digits> for an Ethereum account (given as eth|<40 hex> in any casing, 0x<40 hex> or bare hex), client|<id> as written. eth|0x<hex> is not an address form. This is galaChainUserRef of @gala-chain/gala-core-sdk, the one implementation; only the error for a spelling that is no address at all is this package's. Every place this SDK puts a user identity on the wire goes through it, so what is signed, sent and compared on the backend (owner === position.owner, strict) is always the chain's own spelling.

Parameters​

value​

unknown

The identity the caller gave.

field​

string

The field name reported in the error's params.field.

Returns​

string

Throws​

GalaSDKError core's INVALID_ETH_USER_REF_PREFIX (passed through as it is: its message says an eth| reference takes the 40 hex digits with no 0x and names the correct spelling, params.expected) for eth|0x...; GSwapSDKError INVALID_WALLET_ADDRESS for anything else, a mixed-case spelling whose casing is not the EIP-55 checksum included (a typo); nothing is signed or sent.