MCPcopy Create free account
hub / github.com/cardstack/cardstack / hexToI32

Function hexToI32

packages/cardpay-subgraph/src/abi.ts:119–125  ·  view source on GitHub ↗
(hex: string)

Source from the content-addressed store, hash-verified

117}
118
119function hexToI32(hex: string): i32 {
120 if (hex.startsWith('0x')) {
121 hex = hex.slice(2);
122 }
123 let unpadded = removeZeroPadding(hex);
124 return I32.parseInt(unpadded, 16);
125}
126
127function removeZeroPadding(hex: string): string {
128 while (hex.startsWith('0')) {

Callers 1

decodeFunction · 0.85

Calls 1

removeZeroPaddingFunction · 0.85

Tested by

no test coverage detected