Vector of BytesN<4> is having trouble
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust, typescript
- Domain
- api
Research direction
Reproduce the contract.mint call using the shown Vec<BytesN<4>> canvas, then inspect node_modules/@stellar/stellar-sdk/lib/contract_spec.js at scValToNative and dist/esm/assembled-tx.js where result conversion is invoked. Done means the call no longer raises the reported type error for this vector result.
Written by the indexing model from the issue text.
Description
Soroban version
% soroban --version
soroban 20.2.0 (v20.0.0-rc3-125-g07dcd3c78a15f3ad0db023c3242e154443eb106a)
soroban-env 20.1.0 (36d33cb6c986c9a8a9200b7eb04cf02e2c3f0ef4)
soroban-env interface version 85899345920
stellar-xdr 20.0.2 (a928e82943e4e93c887555fdec3b1e139ad810d2)
xdr curr (bb54e505f814386a3f45172e0b7e95b7badbe969)
Relevant rust contract code (see the canvas arg)
pub fn mint(
env: Env,
canvas: Vec<BytesN<4>>,
owner: Address,
author: String,
) -> Option<Vec<BytesN<4>>> { }
The generated TS binding interface for the above contract function
const { result } = await contract.mint({
canvas: [
Buffer.from([226, 148, 140, 0]),
Buffer.from([226, 148, 172, 0]),
Buffer.from([226, 148, 172, 0]),
Buffer.from([226, 148, 172, 0]),
Buffer.from([226, 148, 144, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 150, 128, 0]),
Buffer.from([226, 150, 132, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 150, 136, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 150, 128, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 150, 132, 0]),
Buffer.from([226, 150, 128, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 148, 130, 0]),
Buffer.from([226, 148, 180, 0]),
Buffer.from([226, 148, 180, 0]),
Buffer.from([226, 148, 180, 0]),
Buffer.from([226, 148, 180, 0]),
Buffer.from([226, 148, 180, 0]),
],
owner: 'GAKZAQ5AIODB635TLYSAV7NM3TV4LCHMOBHLNY7LEHO3LWDHLK4UG6QK',
author: 'kalepail'
})
The resulting error when running the above code
413 | var valTypes = tuple.valueTypes();
414 | return ((_scv$vec2 = scv.vec()) !== null && _scv$vec2 !== void 0 ? _scv$vec2 : []).map(function (elm, i) {
415 | return _this5.scValToNative(elm, valTypes[i]);
416 | });
417 | }
418 | throw new TypeError("Type ".concat(typeDef, " was not vec, but ").concat(scv, " is"));
^
TypeError: Type [object Object] was not vec, but [object Object] is
at scValToNative (/Users/tylervanderhoeven/Desktop/kalewalk/kalewalk-sdk/node_modules/@stellar/stellar-sdk/lib/contract_spec.js:418:19)
at funcResToNative (/Users/tylervanderhoeven/Desktop/kalewalk/kalewalk-sdk/node_modules/@stellar/stellar-sdk/lib/contract_spec.js:100:14)
at result (/Users/tylervanderhoeven/Desktop/kalewalk/kalewalk-sdk/dist/esm/assembled-tx.js:139:20)
at /Users/tylervanderhoeven/Desktop/kalewalk/index.ts:35:26
- Dominant language
- Rust
- Stars
- 123
- Forks
- 141
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-cli#2384 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stellar/stellar-cli#2347 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
stellar/stellar-cli#2723 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
stellar/stellar-cli#2722 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
stellar/stellar-cli#2703 ·
All issues in stellar/stellar-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100