@fuel-ts/abi-coder
Advanced tools
Comparing version 0.0.0-master-a04bae3 to 0.0.0-master-a4544ae
@@ -39,7 +39,9 @@ "use strict"; | ||
expect(encoded).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000'); | ||
encoded = abiCoder.encode(['b256'], ['0x0']); | ||
expect(encoded).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000'); | ||
decoded = abiCoder.decode(['b256'], encoded); | ||
expect(decoded).toEqual(['0x0000000000000000000000000000000000000000000000000000000000000000']); | ||
}); | ||
it('encodes and decodes b256 starting with zero', () => { | ||
const encoded = abiCoder.encode(['b256'], ['0x00579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b']); | ||
expect(encoded).toEqual('0x00579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b'); | ||
const decoded = abiCoder.decode(['b256'], encoded); | ||
expect(decoded).toEqual(['0x00579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b']); | ||
}); | ||
it('encodes and decodes byte', () => { | ||
@@ -171,3 +173,5 @@ let encoded = abiCoder.encode(['byte'], ['255']); | ||
expect(() => abiCoder.encode(['b256'], ['0x'])).toThrow('Invalid b256'); | ||
expect(() => abiCoder.encode(['b256'], ['0x0'])).toThrow('Invalid b256'); | ||
expect(() => abiCoder.encode(['b256'], ['0x00'])).toThrow('Invalid b256'); | ||
}); | ||
}); |
@@ -17,4 +17,3 @@ "use strict"; | ||
try { | ||
const numericValue = bignumber_1.BigNumber.from(value); | ||
encodedValue = numericValue.isZero() ? encodedValue : (0, bytes_1.arrayify)(numericValue); | ||
encodedValue = (0, bytes_1.arrayify)(value); | ||
} | ||
@@ -21,0 +20,0 @@ catch (error) { |
{ | ||
"name": "@fuel-ts/abi-coder", | ||
"version": "0.0.0-master-a04bae3", | ||
"version": "0.0.0-master-a4544ae", | ||
"description": "", | ||
@@ -20,3 +20,3 @@ "author": "Fuel Labs <contact@fuel.sh> (https://fuel.network/)", | ||
}, | ||
"gitHead": "d871f38ba477a5441fcd124f0d2db7a17ed9497a" | ||
"gitHead": "20320864b80a372dd51206ff2939fed39e60a70e" | ||
} |
Sorry, the diff of this file is not supported yet
76768
1230