chain138-snap: CodeQL workflow, npm README, publish script, v0.1.1

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-02-15 22:31:06 -08:00
parent 6bdc9f361c
commit b6a776e5d7
10 changed files with 167 additions and 27 deletions

View File

@@ -1 +1 @@
{"version":"dev","buildTime":"2026-02-16T03:22:42.028Z"}
{"version":"dev","buildTime":"2026-02-16T06:07:18.288Z"}

View File

@@ -1,12 +1,65 @@
# TypeScript Example Snap
# chain138-snap
This snap demonstrates how to develop a snap with TypeScript. It is a simple
snap that displays a confirmation dialog when the `hello` JSON-RPC method is
called.
**Chain 138 Snap** adds [DeFi Oracle Meta Mainnet](https://chainlist.org/chain/138) (ChainID 138) and **ALL Mainnet** (651940) support inside MetaMask: network params, token list, market data, swap quotes, and CCIP bridge routes.
## Testing
MetaMask already supports Chain 138 as a custom EVM network, but native **Swaps**, **Portfolio Bridge**, and **USD pricing** do not include Chain 138. This Snap provides in-wallet swap quotes, bridge routes, and market data by calling your token-aggregation (or compatible) API.
The snap comes with some basic tests, to demonstrate how to write tests for
snaps. To test the snap, run **pnpm run test** (or **yarn test**) from the repo root, or `pnpm run test` / `yarn test` in this directory. This will use
[`@metamask/snaps-jest`](https://github.com/MetaMask/snaps/tree/main/packages/snaps-jest)
to run the tests in `src/index.test.ts`.
## Install
1. Install [MetaMask](https://metamask.io/) (extension or mobile).
2. From a dApp or the [companion site](https://github.com/bis-innovations/chain138-snap), connect and add the Snap using the ID below.
**Snap ID:** `npm:chain138-snap`
## Usage
dApps invoke the Snap via the MetaMask provider:
```javascript
// Connect / install the Snap (your dApp typically does this once)
await ethereum.request({
method: 'wallet_requestSnaps',
params: {
'npm:chain138-snap': {},
},
});
// Call a method (e.g. get networks or market data)
const result = await ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:chain138-snap',
request: {
method: 'get_networks',
params: { apiBaseUrl: 'https://your-token-aggregation-api.com' },
},
},
});
```
For **market data**, **swap quotes**, and **bridge routes**, the dApp must pass `apiBaseUrl` (your token-aggregation service base URL) in the request params. Optional URL params: `networksUrl`, `tokenListUrl`, `bridgeListUrl`.
### RPC methods
| Method | Description |
|--------|-------------|
| `hello` | Basic test; returns a greeting. |
| `get_networks` | Full EIP-3085 chain params (Chain 138, Ethereum, ALL Mainnet). |
| `get_chain138_config` | Chain 138 config from API. |
| `get_chain138_market_chains` | Market chains list. |
| `get_token_list` / `get_token_list_url` | Token list (optional `chainId`). |
| `get_oracles` | Oracles config. |
| `show_dynamic_info` | In-Snap dialog with networks and token list URL. |
| `get_market_summary` / `show_market_data` | Tokens and USD prices. |
| `get_bridge_routes` / `show_bridge_routes` | CCIP bridge routes. |
| `get_swap_quote` / `show_swap_quote` | Swap quote (requires `tokenIn`, `tokenOut`, `amountIn`). |
## Repository and docs
- **Source:** [github.com/bis-innovations/chain138-snap](https://github.com/bis-innovations/chain138-snap)
- **Integrator guide:** [INTEGRATORS.md](https://github.com/bis-innovations/chain138-snap/blob/main/INTEGRATORS.md) (Snap ID, `apiBaseUrl`, optional URLs)
- **Testing / publishing:** [TESTING_INSTRUCTIONS.md](https://github.com/bis-innovations/chain138-snap/blob/main/TESTING_INSTRUCTIONS.md), [PUSH_AND_PUBLISH.md](https://github.com/bis-innovations/chain138-snap/blob/main/PUSH_AND_PUBLISH.md)
## License
MIT-0 OR Apache-2.0

View File

@@ -1,6 +1,6 @@
{
"name": "chain138-snap",
"version": "0.1.0",
"version": "0.1.1",
"description": "Chain 138 (DeFi Oracle Meta Mainnet) and ALL Mainnet Snap: networks, token list, market data, swap quotes, CCIP bridge routes for MetaMask.",
"repository": {
"type": "git",

View File

@@ -1,5 +1,5 @@
{
"version": "0.1.0",
"version": "0.1.1",
"description": "Chain 138 (DeFi Oracle Meta Mainnet) and ALL Mainnet: networks, token list, market data, swap quotes, and CCIP bridge routes for MetaMask.",
"proposedName": "Chain 138",
"repository": {
@@ -7,7 +7,7 @@
"url": "https://github.com/bis-innovations/chain138-snap.git"
},
"source": {
"shasum": "BP9yQblP1R+fSCxYQjdV965YIDdal9Xx3ZiSTbmJYik=",
"shasum": "6CuMlWe0q/GCAHp8l6U+niT/Um5DHEYex4GPhbs5bkg=",
"location": {
"npm": {
"filePath": "dist/bundle.js",