Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi inputs & multi outputs #4

Closed
xhliu opened this issue Sep 18, 2023 · 5 comments · Fixed by #20
Closed

multi inputs & multi outputs #4

xhliu opened this issue Sep 18, 2023 · 5 comments · Fixed by #20
Assignees
Labels
enhancement New feature or request

Comments

@xhliu
Copy link
Contributor

xhliu commented Sep 18, 2023

for stateless & stateful contracts, similar to https://github.com/sCrypt-Inc/scrypt-ord/blob/master/tests/contracts/ftCounter.ts.

Just use multiCall?

transfer(inputInstances, outputInstances, signer)

This is mostly about multi inputs, e.g., multi call to contracts. So just make it similar to https://docs.scrypt.io/advanced/how-to-call-multiple-contracts, using partial tx.

@xhliu xhliu added the enhancement New feature or request label Sep 18, 2023
@xhliu xhliu assigned gitzhou and zhfnjust and unassigned gitzhou Sep 18, 2023
@xhliu
Copy link
Contributor Author

xhliu commented Sep 22, 2023

Rename multi.spec.ts to multiInput.spec.ts.

@xhliu
Copy link
Contributor Author

xhliu commented Sep 22, 2023

Typo ordp2kh -> ordp2pkh
https://github.com/sCrypt-Inc/scrypt-ord/blob/master/tests/specs/multi.spec.ts#L21

@xhliu
Copy link
Contributor Author

xhliu commented Sep 22, 2023

Use instance.methods.unlock to transfer

const { tx, nexts } = await OrdP2PKH.transfer(
ordP2PKHs,
signer,
recipients
)

Also I thought we removed nexts in return #3 (comment).

@xhliu
Copy link
Contributor Author

xhliu commented Sep 22, 2023

Above does not work for non-OrdP2PKH contracts. What if there is a P2PKH, hashpuzzle, or counter input each?

@xhliu
Copy link
Contributor Author

xhliu commented Sep 22, 2023

Merge these two into
dummyBsv20(..., prepend: boolean =false).

export function dummyAppendbsv20(addr: bsv.Address, tick: string, amt: bigint) {
return {
script: bsv.Script.buildPublicKeyHashOut(addr)
.add(Ordinal.createTransfer(tick, amt))
.toHex(),
satoshis: 1,
txId: randomBytes(32).toString('hex'),
outputIndex: 0,
}
}
export function dummyPrependbsv20(

Same for

export function dummyPrependNFT(addr: bsv.Address, text: string) {
return {
script: Ordinal.create({
content: text,
contentType: 'text/plain',
})
.add(bsv.Script.buildPublicKeyHashOut(addr))
.toHex(),
satoshis: 1,
txId: randomBytes(32).toString('hex'),
outputIndex: 0,
}
}
export function dummyAppendNFT(addr: bsv.Address, text: string) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants