This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
XdrWriterError [TypeError]: XDR Write Error: 0 is not a Hyper #83
Closed
Description
Describe the bug
XdrWriterError [TypeError]: XDR Write Error: 0 is not a Hyper
We're getting this when trying to call .prepareTransaction or when calling .toXDR() on a transaction for soroban. This call works with soroban-client 0.5.0.
What version are you on?
soroban-client 0.6.1
To Reproduce
Steps to reproduce the behavior:
- github.com/blocktimefinancial/option
- See the opxpump.js code.
- Scroll down to line 128
- See error
Expected behavior
Print .toXDR() for the transaction and call .prepareTransaction
Additional context
Dump from pxpump.js which shows the parameter array is valid ScVal I128's
Converted quote:
[
ChildUnion {
_switch: ChildEnum { name: 'scvI128', value: 10 },
_arm: 'i128',
_armType: [class ChildStruct extends Struct] {
structName: 'Int128Parts',
_fields: [
[
'hi',
[class Hyper extends XdrPrimitiveType] {
MAX_VALUE: [Hyper],
MIN_VALUE: [Hyper]
}
],
[
'lo',
[class UnsignedHyper extends XdrPrimitiveType] {
MAX_VALUE: [UnsignedHyper],
MIN_VALUE: [UnsignedHyper]
}
]
]
},
_value: ChildStruct {
_attributes: {
lo: UnsignedHyper { _value: 1n },
hi: UnsignedHyper { _value: 0n }
}
}
},
ChildUnion {
_switch: ChildEnum { name: 'scvI128', value: 10 },
_arm: 'i128',
_armType: [class ChildStruct extends Struct] {
structName: 'Int128Parts',
_fields: [
[
'hi',
[class Hyper extends XdrPrimitiveType] {
MAX_VALUE: [Hyper],
MIN_VALUE: [Hyper]
}
],
[
'lo',
[class UnsignedHyper extends XdrPrimitiveType] {
MAX_VALUE: [UnsignedHyper],
MIN_VALUE: [UnsignedHyper]
}
]
]
},
_value: ChildStruct {
_attributes: {
lo: UnsignedHyper { _value: 42035n },
hi: UnsignedHyper { _value: 0n }
}
}
},
ChildUnion {
_switch: ChildEnum { name: 'scvI128', value: 10 },
_arm: 'i128',
_armType: [class ChildStruct extends Struct] {
structName: 'Int128Parts',
_fields: [
[
'hi',
[class Hyper extends XdrPrimitiveType] {
MAX_VALUE: [Hyper],
MIN_VALUE: [Hyper]
}
],
[
'lo',
[class UnsignedHyper extends XdrPrimitiveType] {
MAX_VALUE: [UnsignedHyper],
MIN_VALUE: [UnsignedHyper]
}
]
]
},
_value: ChildStruct {
_attributes: {
lo: UnsignedHyper { _value: 1684508428000n },
hi: UnsignedHyper { _value: 0n }
}
}
},
ChildUnion {
_switch: ChildEnum { name: 'scvI128', value: 10 },
_arm: 'i128',
_armType: [class ChildStruct extends Struct] {
structName: 'Int128Parts',
_fields: [
[
'hi',
[class Hyper extends XdrPrimitiveType] {
MAX_VALUE: [Hyper],
MIN_VALUE: [Hyper]
}
],
[
'lo',
[class UnsignedHyper extends XdrPrimitiveType] {
MAX_VALUE: [UnsignedHyper],
MIN_VALUE: [UnsignedHyper]
}
]
]
},
_value: ChildStruct {
_attributes: {
lo: UnsignedHyper { _value: 4n },
hi: UnsignedHyper { _value: 0n }
}
}
}
]
Creating contract transaction for cd0ca2f721d91df334b79fb1e043920919ed0c6b09f930af5048a50930fb7f44
Preparing transaction for cd0ca2f721d91df334b79fb1e043920919ed0c6b09f930af5048a50930fb7f44
/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:611
if (!(value instanceof this)) throw new _errors__WEBPACK_IMPORTED_MODULE_1__.XdrWriterError(`${value} is not a Hyper`); ^
XdrWriterError [TypeError]: XDR Write Error: 0 is not a Hyper
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:611:41)
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1349:12)
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1547:21)
at VarArray.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1800:23)
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1547:21)
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1349:12)
at VarArray.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1800:23)
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1349:12)
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1547:21)
at Function.write (/home/lj/src/soroban/soroban-examples/option/pxpump/node_modules/stellar-base/node_modules/js-xdr/lib/xdr.js:1349:12)