UNPKG

wowok

Version:

Wowok Blockchain TypeScript API

1 lines 1.06 kB
import{isSerializedBcs}from'../_deps/bcs/index.js';import{bcs}from'../bcs/index.js';import{pureBcsSchemaFromTypeName}from'../bcs/pure.js';export function createPure(a){function b(c,d){if(typeof c==='string')return a(pureBcsSchemaFromTypeName(c)['serialize'](d));if(c instanceof Uint8Array||isSerializedBcs(c))return a(c);throw new Error('tx.pure\x20must\x20be\x20called\x20either\x20a\x20bcs\x20type\x20name,\x20or\x20a\x20serialized\x20bcs\x20value');}return b['u8']=c=>a(bcs['U8']['serialize'](c)),b['u16']=c=>a(bcs['U16']['serialize'](c)),b['u32']=c=>a(bcs['U32']['serialize'](c)),b['u64']=c=>a(bcs['U64']['serialize'](c)),b['u128']=c=>a(bcs['U128']['serialize'](c)),b['u256']=c=>a(bcs['U256']['serialize'](c)),b['bool']=c=>a(bcs['Bool']['serialize'](c)),b['string']=c=>a(bcs['String']['serialize'](c)),b['address']=c=>a(bcs['Address']['serialize'](c)),b['id']=b['address'],b['vector']=(c,d)=>{return a(bcs['vector'](pureBcsSchemaFromTypeName(c))['serialize'](d));},b['option']=(c,d)=>{return a(bcs['option'](pureBcsSchemaFromTypeName(c))['serialize'](d));},b;}