UNPKG

@confluxfans/cip-23

Version:

Tiny library with utility functions that can help with signing and verifying CIP-23 based messages

13 lines (11 loc) 707 B
import { encode } from './abi'; describe('encode', () => { it('encodes types and values to ABI', () => { expect(encode(['uint256', 'uint256'], [12345, 56789]).toString('hex')).toBe( '0000000000000000000000000000000000000000000000000000000000003039000000000000000000000000000000000000000000000000000000000000ddd5' ); expect(encode(['bytes32', 'string'], ['0x123456789', 'foo bar']).toString('hex')).toBe( '123456780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000007666f6f2062617200000000000000000000000000000000000000000000000000' ); }); });