Skip to content

Convert a BitBadges SDK message to a precompile function call

convertMessageToPrecompileCall(message, evmAddress?): PrecompileCallResult

Defined in: packages/bitbadgesjs-sdk/src/transactions/precompile/utils.ts:185

Convert a BitBadges SDK message to a precompile function call

Parameters

message

any

The SDK message (any supported message type)

evmAddress?

string

The EVM address of the caller (for address conversion)

Returns

PrecompileCallResult

The function name, encoded data, and precompile address for the precompile call

Throws

If encoding fails

Example

typescript
const msg = new MsgCreateCollection({...});
const result = convertMessageToPrecompileCall(msg, '0x1234...');
// result.functionName = 'createCollection'
// result.data = '0x...' (encoded function call with JSON string)
// result.precompileAddress = '0x1001' (tokenization precompile)

Edit this page on GitHub