-
Notifications
You must be signed in to change notification settings - Fork 82
add TypeScript SDK page & improve other pages #383
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #383 +/- ##
=======================================
Coverage 87.21% 87.21%
=======================================
Files 48 48
Lines 3276 3276
Branches 593 593
=======================================
Hits 2857 2857
Misses 329 329
Partials 90 90 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rkalis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new TypeScript SDK overview page and improves documentation across multiple files with better explanations, consistent link formatting, and updated content.
Key changes:
- Adds a new comprehensive TypeScript SDK overview page explaining the 4 SDK classes and their usage
- Improves documentation clarity with better explanations of ElectrumNetworkProvider, MockNetworkProvider, and VM resource usage
- Standardizes external link references using markdown link format at the bottom of files
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| website/sidebars.ts | Adds new typescript-sdk page to sidebar navigation |
| website/docs/sdk/typescript-sdk.md | New comprehensive overview page for TypeScript SDK |
| website/docs/sdk/transactions.md | Clarifies VM resource usage description |
| website/docs/sdk/transaction-builder.md | Documents new allowImplicitFungibleTokenBurn option |
| website/docs/sdk/other-network-providers.md | Updates MockNetworkProvider documentation with options interface |
| website/docs/sdk/network-provider.md | Adds sections on provider-specific functionality and limitations |
| website/docs/sdk/instantiation.md | Reorganizes constructor documentation and moves tips closer to relevant content |
| website/docs/sdk/electrum-network-provider.md | Expands documentation with custom client examples and connection management details |
| website/docs/releases/release-notes.md | Adds separator and social media link reference |
| website/docs/language/examples.md | Converts inline links to markdown reference format |
| website/docs/guides/optimization.md | Restructures hand-optimization section with two distinct methods |
| website/docs/guides/lifecycle.md | Converts inline links to markdown reference format |
| website/docs/guides/covenants.md | Converts inline links to markdown reference format |
| website/docs/compiler/compiler.md | Adds info box about compiler/SDK separation |
| website/docs/basics/about-bch.md | Improves description of BCH's VM improvements and converts links to reference format |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| The usage of the 4 classes in your code is as follows: before using the SDK you create one or multiple contract artifacts compiled by `cashc`. Then to start using the SDK, you instantiate a `NetworkProvider`, which you then provide to instantiate a `Contract` from an `Artifact`. Once you have a `Contract` instance, you can use it in the `TransactionBuilder`. During transaction building you might need to generate a signature, in which case you would instantiate a `SignatureTemplate`. | ||
|
|
||
| For an more complete example of the SDK flow, refer to the [SDK Example](./examples.md). |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The article "an" should be "a" before "more complete example" since "more" starts with a consonant sound.
| For an more complete example of the SDK flow, refer to the [SDK Example](./examples.md). | |
| For a more complete example of the SDK flow, refer to the [SDK Example](./examples.md). |
| const contract = new Contract(P2pkhArtifact, contractArguments, { provider }); | ||
|
|
||
| const aliceSignatureTemplate = new SignatureTemplate(aliceWif); | ||
| const unlocker = contract.unlock.transfer(aliceSignatureTemplate) |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon at the end of the statement. For consistency with the rest of the code example, this line should end with a semicolon.
| const unlocker = contract.unlock.transfer(aliceSignatureTemplate) | |
| const unlocker = contract.unlock.transfer(aliceSignatureTemplate); |
|
|
||
| ## Advanced: non-CashScript Contracts | ||
|
|
||
| You can also use the CashScript SDK without relying on the CashScript contract language and compiler. This way you can still leverage the a lot of the tooling while having full control over the raw BCH script so this can be hand-written or hand-optimized. |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two typos in this sentence: "leverage the a lot" should be "leverage a lot". The article "the" should be removed.
| You can also use the CashScript SDK without relying on the CashScript contract language and compiler. This way you can still leverage the a lot of the tooling while having full control over the raw BCH script so this can be hand-written or hand-optimized. | |
| You can also use the CashScript SDK without relying on the CashScript contract language and compiler. This way you can still leverage a lot of the tooling while having full control over the raw BCH script so this can be hand-written or hand-optimized. |
| ## Creating an ElectrumNetworkProvider | ||
|
|
||
| The ElectrumNetworkProvider uses [@electrum-cash/network][electrum-cash] to connect to the BCH network. Both `network` and `options` parameters are optional, and they default to mainnet with the `bch.imaginary.cash` electrum server. | ||
| The ElectrumNetworkProvider uses [@electrum-cash/network][electrum-cash] library to connect to the configured electrum server. The connection uses a single, trusted electrum server so it does no have any fallback logic and does not validate SPV proofs for chain inclusion. |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "do no have" should be "does not have". The verb conjugation should match the singular subject "connection".
| The ElectrumNetworkProvider uses [@electrum-cash/network][electrum-cash] library to connect to the configured electrum server. The connection uses a single, trusted electrum server so it does no have any fallback logic and does not validate SPV proofs for chain inclusion. | |
| The ElectrumNetworkProvider uses [@electrum-cash/network][electrum-cash] library to connect to the configured electrum server. The connection uses a single, trusted electrum server so it does not have any fallback logic and does not validate SPV proofs for chain inclusion. |
| https://x.com/CashScriptBCH/status/1973692336782876974 | ||
|
|
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be a raw Twitter/X URL rather than a proper documentation entry. Release notes should contain a formatted description of the release or its changes, not just a social media link. Consider adding a proper release heading and description.
| https://x.com/CashScriptBCH/status/1973692336782876974 | |
| ## v0.11.6 | |
| #### CashScript SDK | |
| - :memo: Release announcement and minor documentation updates. See [CashScript announcement on X](https://x.com/CashScriptBCH/status/1973692336782876974). |
| ) | ||
| ``` | ||
|
|
||
| A CashScript contract can be instantiated by providing an `Artifact` object, a list of constructor arguments, and optionally an options object configuring `NetworkProvider` and `addressType`. |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description on line 22 says the options object is "optional," but the type signature shows options as a required parameter (without ?). Looking at the actual interface definition, provider is a required field in ContractOptions. The description should be updated to clarify that the options parameter is required, though the addressType field within it is optional.
| A CashScript contract can be instantiated by providing an `Artifact` object, a list of constructor arguments, and optionally an options object configuring `NetworkProvider` and `addressType`. | |
| A CashScript contract can be instantiated by providing an `Artifact` object, a list of constructor arguments, and an options object configuring the required `NetworkProvider` and optional `addressType`. |
| Although BCH and BTC share the same Bitcoin fundamentals, both projects have significantly diverged in some areas since 2017. For example, Bitcoin Cash does not have Segwit or Taproot, instead Bitcoin Cash has had multiple upgrades specifically focused on improving the smart contract capabilities. Bitcoin Cash has re-enabled many useful opcodes, has introduce native introspection, has added CashTokens, has reworked the script limits and introduced BigInts. | ||
|
|
||
| So part that **has** significantly diverged between BTC and BCH is the *virtual machine* (VM), the environment in which smart contracts are evaluated. So the greatly improved VM specifically is what makes it possible to write powerful smart contracts on BCH in the first place! | ||
| So part that **has** significantly diverged between BTC and BCH is the *virtual machine* (VM), the environment in which smart contracts are evaluated. The Bitcoin Cash VM is also referred to as the **CashVM**. The greatly improved VM specifically is what makes it possible to write powerful smart contracts on BCH in the first place! On the overview of [all the BCH network upgrades][BCH upgrades], you'll notice the recent years have been fully focused on VM improvements. |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: "So part that" is missing an article. It should be "So the part that" or "So a part that".
| So part that **has** significantly diverged between BTC and BCH is the *virtual machine* (VM), the environment in which smart contracts are evaluated. The Bitcoin Cash VM is also referred to as the **CashVM**. The greatly improved VM specifically is what makes it possible to write powerful smart contracts on BCH in the first place! On the overview of [all the BCH network upgrades][BCH upgrades], you'll notice the recent years have been fully focused on VM improvements. | |
| So the part that **has** significantly diverged between BTC and BCH is the *virtual machine* (VM), the environment in which smart contracts are evaluated. The Bitcoin Cash VM is also referred to as the **CashVM**. The greatly improved VM specifically is what makes it possible to write powerful smart contracts on BCH in the first place! On the overview of [all the BCH network upgrades][BCH upgrades], you'll notice the recent years have been fully focused on VM improvements. |
|
|
||
| If you are not using the CashScript contract language, you can still use the CashScript SDK for transaction building and BCH networking functionality! This can be especially useful if you are familiar with the CashScript classes and want manual control over the input and outputs in a transaction. The SDK makes it easy to spend from P2PKH inputs and send to different types of outputs, including OP_RETURN data outputs. | ||
|
|
||
| It's also possible the use the CashScript SDK for hand-optimized contract **not** written with the CashScript contract language, but this is considered [advanced usage](#advanced-non-cashscript-contracts). |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo: "possible the use" should be "possible to use". The word "to" is missing between "possible" and "the".
| It's also possible the use the CashScript SDK for hand-optimized contract **not** written with the CashScript contract language, but this is considered [advanced usage](#advanced-non-cashscript-contracts). | |
| It's also possible to use the CashScript SDK for hand-optimized contract **not** written with the CashScript contract language, but this is considered [advanced usage](#advanced-non-cashscript-contracts). |
|
|
||
| ## Limitations | ||
|
|
||
| If you look at the [Transaction Lifecycle](guides/lifecycle.md) guide then you'll see there are blockchain edge cases like chain re-organisations or double spends. Ideally the `NetworkProvider` interface would be able to provide more detailed `Utxo` chain information like whether the UTXO is unconfirmed or confirmed, the number of confirmations and the block-hash of the block which included the transaction creating the UTXO. |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link path is incorrect. It should be /docs/guides/lifecycle (with a leading slash) to be consistent with other internal documentation links in this codebase, or it should be a relative path like ../guides/lifecycle.md.
| If you look at the [Transaction Lifecycle](guides/lifecycle.md) guide then you'll see there are blockchain edge cases like chain re-organisations or double spends. Ideally the `NetworkProvider` interface would be able to provide more detailed `Utxo` chain information like whether the UTXO is unconfirmed or confirmed, the number of confirmations and the block-hash of the block which included the transaction creating the UTXO. | |
| If you look at the [Transaction Lifecycle](../guides/lifecycle.md) guide then you'll see there are blockchain edge cases like chain re-organisations or double spends. Ideally the `NetworkProvider` interface would be able to provide more detailed `Utxo` chain information like whether the UTXO is unconfirmed or confirmed, the number of confirmations and the block-hash of the block which included the transaction creating the UTXO. |
|
|
||
| ## How BCH differs from BTC | ||
|
|
||
| Although BCH and BTC share the same Bitcoin fundamentals, both projects have significantly diverged in some areas since 2017. For example, Bitcoin Cash does not have Segwit or Taproot, instead Bitcoin Cash has had multiple upgrades specifically focused on improving the smart contract capabilities. Bitcoin Cash has re-enabled many useful opcodes, has introduce native introspection, has added CashTokens, has reworked the script limits and introduced BigInts. |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: "has introduce" should be "has introduced". The past participle form of "introduce" is "introduced".
| Although BCH and BTC share the same Bitcoin fundamentals, both projects have significantly diverged in some areas since 2017. For example, Bitcoin Cash does not have Segwit or Taproot, instead Bitcoin Cash has had multiple upgrades specifically focused on improving the smart contract capabilities. Bitcoin Cash has re-enabled many useful opcodes, has introduce native introspection, has added CashTokens, has reworked the script limits and introduced BigInts. | |
| Although BCH and BTC share the same Bitcoin fundamentals, both projects have significantly diverged in some areas since 2017. For example, Bitcoin Cash does not have Segwit or Taproot, instead Bitcoin Cash has had multiple upgrades specifically focused on improving the smart contract capabilities. Bitcoin Cash has re-enabled many useful opcodes, has introduced native introspection, has added CashTokens, has reworked the script limits and introduced BigInts. |
No description provided.