sui icon indicating copy to clipboard operation
sui copied to clipboard

Sui Code Bug or Feature Request

Open daihaojun554 opened this issue 1 year ago • 4 comments
trafficstars

const tx = new Transaction();
  tx.setGasBudget(10000000)
  const p0 = tx.pure.u64(BigInt(0))
  const money = parseInt(0.01 * 1e9)

  // tx.transferObjects([coin], address);
const p1 = tx.sharedObjectRef({
    objectId: "0x90e2dd6643d1eafe02d76a161a962e16bb573c55af934cfc86e911d64aa68b9b",
    initialSharedVersion:19218095,
    mutable: false,
})
const p2 = tx.sharedObjectRef({
  objectId: "0x0000000000000000000000000000000000000000000000000000000000000006",
  initialSharedVersion:1,
  mutable: false,
})
const p3 = tx.sharedObjectRef({
  objectId: "0x8447b6840ae21edaaf7baf9bbdf5749fff96ad4262123efd83e8d214c887f21a",
  initialSharedVersion:11984592,
  mutable: true,
})
const p4 = tx.sharedObjectRef({
  objectId: "0x23c53c945744198ff070ea9c13f9263694f3441b52b13158ff6dc2da5416e6ab",
  initialSharedVersion:19217233,
  mutable: true,
})
const p5 = tx.sharedObjectRef({
  objectId: "0x8313624f33dd48ab49b22de7032cc51f5539576fdaacb8321d408d9cb4e5cdf7",
  initialSharedVersion:11984592,
  mutable: true,
})
  const p6 = tx.pure.string("asdkjl1231")
  const p7 = tx.pure.string("guokaichen6166")
  
  
  tx.moveCall({
    target: target,
    arguments: [
        p0, 
        tx.object(p1),
        tx.object(p2),
        tx.object(p3),
        tx.object(p4),
        tx.object(p5),
        p6,
        p7
    ],
});
tx.splitCoins(tx.gas, [money]);
const res = await sendTx(address, tx)
console.log(res)

why does the p0 that I built look like this?

image

i need this

image

daihaojun554 avatar Aug 22 '24 09:08 daihaojun554

Thanks for the question @daihaojun554.

stefan-mysten avatar Aug 22 '24 15:08 stefan-mysten

(package: 0x626a…9a74, module: 'hive_chronicles', function: kraft_hive_profile, arguments: [Input(1), Input(2), Input(3), Input(4), Input(5), Result(0), Input(6), Input(7)] and how can i build result0 this arg?

daihaojun554 avatar Aug 23 '24 02:08 daihaojun554

I'm not sure how valueType is determined in that explorer, but the bytes in the transaction for those pure types are exactly identical. A bcs encoded u64 0 value is [0,0,0,0,0,0,0,0]. Transactions do not contain type information when submitted (nothing in the transaction knows that those bytes are a u64 value). I think to display the value in an explorer as u64 0, it would need to look at how the value is used, and determine the type of the move call argument it was passed to.

hayes-mysten avatar Aug 23 '24 03:08 hayes-mysten

thanks, and how can i build this Result0 arg,i can't find the way

daihaojun554 avatar Aug 23 '24 04:08 daihaojun554

Result args are returned from commands. Eg: const result0 = tx.moveCall({ ...} ) which can be used in a future command: const result1 = tx.moveCall({ ..., arguments: [result0, ...] })

hayes-mysten avatar Aug 23 '24 16:08 hayes-mysten

ok thanks ,i have resolve this problem

daihaojun554 avatar Sep 04 '24 14:09 daihaojun554