-
Notifications
You must be signed in to change notification settings - Fork 5
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
refactor 2 #3
Comments
scrypt-ord/src/contracts/onesatNFT.ts Line 71 in 09dbe2a
This is not raw hex, just a string Line 5 in 09dbe2a
|
https://github.com/sCrypt-Inc/scrypt-ord/blob/09dbe2ad0d36f240055e8729027b97c4305b2922/tests/specs/hashPuzzle.spec.ts#L17C18-L17C24
https://github.com/sCrypt-Inc/scrypt-ord/blob/master/tests/specs/hashPuzzle.spec.ts#L19-L21 move all to before() scrypt-ord/tests/specs/hashPuzzle.spec.ts Lines 30 to 39 in 09dbe2a
|
Looks like first output is token change? If yes, let's move it to the last, as sat change. scrypt-ord/tests/specs/hashPuzzle.spec.ts Line 63 in 09dbe2a
Also, add comments throughout to explain, e.g.,
|
https://github.com/sCrypt-Inc/scrypt-ord/blob/09dbe2ad0d36f240055e8729027b97c4305b2922/src/contracts/bsv20V1.ts |
Change to any amount other than 1, which is confusing to 1sat. scrypt-ord/tests/contracts/ftCounter.ts Line 29 in 09dbe2a
|
Rename build1SatStateOutput -> buildStateOutputFT & buildStateOutputNFT. 1Sat is too general here. |
Rename changeAmt -> changeTokenAmt |
Add comments for all files under https://github.com/sCrypt-Inc/scrypt-ord/tree/master/src/contracts, at least for all top-level functions. |
Promise<{
/** The method calling tx */
tx: bsv.Transaction;
changeInstance: BSV20V1 | null
receivers: Array<BSV20V1>
}>
|
hash160 -> pubKey2Addr scrypt-ord/src/contracts/ordP2PKH.ts Line 36 in 0ac28b5
|
|
Let's make the API as close to the original sCrypt (without ordinals) as possible. It is still sCrypt but extended to support ordinals. const recipients = [
{
instance: new HashPuzzle(
toByteString(tick, true),
max,
lim,
sha256(message2)
),
amt: 10n,
},
]
const { tx, atInputIndex } = await hashPuzzle.methods.unlock(message1, { transfer: recipients, tokenChangeAddress: tokenChangeAddr} as OrdMethodCallOptions)
scrypt-ord/tests/specs/hashPuzzle.spec.ts Lines 37 to 52 in 0ac28b5
|
Make scrypt-ord/tests/specs/hashPuzzle.spec.ts Line 35 in 0ac28b5
similar to https://github.com/sCrypt-Inc/boilerplate/blob/5670d548bbc0d7502f037bb0ae20862ca58a89f9/tests/counter.test.ts#L11 Call/transfer multiple times in a chain of txs. |
No need to specially handle withdraw, it's just another transfer to an instance. I suggest removing it. scrypt-ord/tests/specs/hashPuzzle.spec.ts Lines 61 to 79 in 62d5ee7
|
Does it support inscribing NFT to a p2pkh? https://github.com/sCrypt-Inc/scrypt-ord/blob/master/src/contracts/ordP2PKH.ts#L25 |
Move this out of contracts folder to, say, |
ordP2PKH = new OrdP2PKH(address) scrypt-ord/tests/specs/ordP2PKH.spec.ts Line 18 in 62d5ee7
Same everywhere
|
No need to specially handle p2pkh. Can we use the generalized transfer, or remove the whole test file? E.g., this can be just like any other transfer: scrypt-ord/tests/specs/ordP2PKH.spec.ts Line 27 in 62d5ee7
|
Just reuse fromTx() from contractID https://docs.scrypt.io/how-to-deploy-and-call-a-contract/call-deployed#interact. Again, make API as close as before.
Do NOT need tx details to call, such as
|
Let's remove all places where p2pkh is treated differently from a contract. It is just ONE contract. scrypt-ord/src/contracts/onesatNFT.ts Line 121 in 62d5ee7
|
yes |
yes |
Use a CONST variable for this magic number. Same everywhere. const P2pkhScriptLen = 50 scrypt-ord/src/contracts/ordP2PKH.ts Line 54 in 182478c
scrypt-ord/src/contracts/ordP2PKH.ts Line 100 in 182478c
|
scrypt-ord/src/contracts/bsv20V1.ts Line 36 in dba56bc
|
@zhfnjust close this after all is fixed. |
|
setConstructor -> init
scrypt-ord/tests/contracts/nftCounter.ts
Line 11 in 09dbe2a
The text was updated successfully, but these errors were encountered: