@alephium/web3 0.36.0 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -240,12 +240,12 @@ function encodeScriptField(tpe, value) {
240
240
  case 'U256':
241
241
  const u256 = (0, api_1.toApiNumber256)(value);
242
242
  return encodeScriptFieldU256(BigInt(u256));
243
- case 'ByteVec':
244
- const hexStr = (0, api_1.toApiByteVec)(value);
245
- return new Uint8Array([Instruction.bytesConst, ...encodeByteVec(hexStr)]);
246
243
  case 'Address':
247
244
  const address = (0, api_1.toApiAddress)(value);
248
245
  return new Uint8Array([Instruction.addressConst, ...encodeAddress(address)]);
246
+ default: // ByteVec or Contract
247
+ const hexStr = (0, api_1.toApiByteVec)(value);
248
+ return new Uint8Array([Instruction.bytesConst, ...encodeByteVec(hexStr)]);
249
249
  }
250
250
  throw invalidScriptField(tpe, value);
251
251
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/web3",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "A JS/TS library to interact with the Alephium platform",
5
5
  "license": "GPL",
6
6
  "main": "dist/src/index.js",
@@ -236,12 +236,12 @@ export function encodeScriptField(tpe: string, value: Val): Uint8Array {
236
236
  case 'U256':
237
237
  const u256 = toApiNumber256(value)
238
238
  return encodeScriptFieldU256(BigInt(u256))
239
- case 'ByteVec':
240
- const hexStr = toApiByteVec(value)
241
- return new Uint8Array([Instruction.bytesConst, ...encodeByteVec(hexStr)])
242
239
  case 'Address':
243
240
  const address = toApiAddress(value)
244
241
  return new Uint8Array([Instruction.addressConst, ...encodeAddress(address)])
242
+ default: // ByteVec or Contract
243
+ const hexStr = toApiByteVec(value)
244
+ return new Uint8Array([Instruction.bytesConst, ...encodeByteVec(hexStr)])
245
245
  }
246
246
 
247
247
  throw invalidScriptField(tpe, value)