@eco-incorp/sauce 0.99.7 → 0.99.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/dist/names.d.ts.map +1 -1
- package/actions/dist/names.js +16 -6
- package/docs/api/coverage.md +30 -14
- package/docs/guides/cli.md +10 -6
- package/docs/guides/mcp.md +3 -2
- package/docs/guides/protocols-and-tokens.md +4 -4
- package/docs/guides/solana.md +2 -2
- package/mcp/dist/tools.js +6 -4
- package/mcp/dist/tools.js.map +1 -1
- package/package.json +1 -1
- package/sdk/dist/cli/chain.d.ts +4 -1
- package/sdk/dist/cli/chain.d.ts.map +1 -1
- package/sdk/dist/cli/chain.js +7 -2
- package/sdk/dist/cli/chain.js.map +1 -1
- package/sdk/dist/cli/diagnostics.d.ts.map +1 -1
- package/sdk/dist/cli/diagnostics.js +26 -1
- package/sdk/dist/cli/diagnostics.js.map +1 -1
- package/sdk/dist/cli/globals.d.ts.map +1 -1
- package/sdk/dist/cli/globals.js +30 -8
- package/sdk/dist/cli/globals.js.map +1 -1
- package/sdk/dist/cli/run.d.ts.map +1 -1
- package/sdk/dist/cli/run.js +4 -3
- package/sdk/dist/cli/run.js.map +1 -1
- package/sdk/dist/cli/solana.d.ts +3 -2
- package/sdk/dist/cli/solana.d.ts.map +1 -1
- package/sdk/dist/cli/solana.js +19 -9
- package/sdk/dist/cli/solana.js.map +1 -1
- package/sdk/dist/routes/chain-exports.generated.d.ts +1 -1
- package/sdk/dist/routes/chain-exports.generated.d.ts.map +1 -1
- package/sdk/dist/routes/chain-exports.generated.js.map +1 -1
- package/sdk/dist/routes/source-globals.d.ts.map +1 -1
- package/sdk/dist/routes/source-globals.generated.d.ts +78 -0
- package/sdk/dist/routes/source-globals.generated.d.ts.map +1 -1
- package/sdk/dist/routes/source-globals.js +2 -1
- package/sdk/dist/routes/source-globals.js.map +1 -1
- package/sdk/dist/routes/stock-tokens.d.ts +41 -21
- package/sdk/dist/routes/stock-tokens.d.ts.map +1 -1
- package/sdk/dist/routes/stock-tokens.generated.d.ts +3 -0
- package/sdk/dist/routes/stock-tokens.generated.d.ts.map +1 -1
- package/sdk/dist/routes/stock-tokens.generated.js +1828 -0
- package/sdk/dist/routes/stock-tokens.generated.js.map +1 -1
- package/sdk/dist/routes/stock-tokens.js +42 -18
- package/sdk/dist/routes/stock-tokens.js.map +1 -1
- package/sdk/dist/routes/token-registry.d.ts +5 -1
- package/sdk/dist/routes/token-registry.d.ts.map +1 -1
- package/sdk/dist/routes/token-registry.js +29 -13
- package/sdk/dist/routes/token-registry.js.map +1 -1
- package/skills/sauce-chains/references/index.md +1 -1
- package/skills/sauce-chains/references/solana-stocks.md +1812 -0
- package/skills/sauce-chains/references/solana.md +3 -0
- package/skills/sauce-globals/SKILL.md +44 -6
- package/skills/sauce-globals/references/stocks.md +1812 -1
- package/skills/sauce-globals/references/tokens.md +1 -1
- package/skills/sauce-solana/SKILL.md +3 -1
- package/skills/sauce-swaps/SKILL.md +1 -1
|
@@ -40,6 +40,9 @@ function main(account: Account): Uint256 {
|
|
|
40
40
|
| `USDT` | `Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB` | `0xce010e60afedb22717bd63192f54145a3f965a33bb82d2c7029eb2ce1e208264` | 6 | SPL Token (`TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) |
|
|
41
41
|
| `WSOL` | `So11111111111111111111111111111111111111112` | `0x069b8857feab8184fb687f634618c035dac439dc1aeb3b5598a0f00000000001` | 9 | SPL Token (`TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) |
|
|
42
42
|
|
|
43
|
+
And 1799 tokenized stocks, each a Token-2022 mint named by its symbol in the same way:
|
|
44
|
+
they are in [solana-stocks.md](solana-stocks.md), with their mints.
|
|
45
|
+
|
|
43
46
|
On devnet, pass a mint that differs as a define, which wins over the symbol
|
|
44
47
|
(`--define USDC=<key>`):
|
|
45
48
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sauce-globals
|
|
3
|
-
description: The names a Sauce program uses without any import, and how they resolve on the chain it is compiled for — token symbols (USDC, USDT, WETH, …) and tokenized stocks (SPCXc, TSLAon, TSLAx,
|
|
3
|
+
description: The names a Sauce program uses without any import, and how they resolve on the chain it is compiled for — token symbols (USDC, USDT, WETH, …) and tokenized stocks (SPCXc, TSLAon, TSLAx, NVDA_US, SPACEX, …, on Ethereum, Base and Solana), Token(address) and a bound const t = Token(x), the token methods .transfer/.approve/.transferFrom/.balanceOf with SafeERC20 behaviour and USDT, the @sauce/token functions, protocol namespaces (UniswapV3.Factory, UniswapV4.StateView, AaveV3.Pool, …) and family aliases, available(...) for a venue a chain may lack, the Namespace_Contract compile-time defines, chain names, chainId and ctx.*. Links generated indexes of every token, protocol contract and chain, the same lists sauce globals prints. Use when writing any Sauce program that moves tokens, calls a protocol or names a chain, when checking whether a name exists on a chain, or when a name does not resolve ("is not a declared variable", "ambiguous", "is not deployed").
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Globals in a Sauce program
|
|
@@ -79,13 +79,17 @@ functions, a token a swap buys or sells.
|
|
|
79
79
|
- **Ethereum**: Backed's xStocks (`TSLAx`, `SPCXx`) and bTokens (`bTSLA`), Ondo Global Markets'
|
|
80
80
|
(`TSLAon`, `SPCXon`), and Mt Pelerin's own shares (`MPS`).
|
|
81
81
|
- **Base**: Coinbase's (`TSLAc`, `SPCXc`) and Backed's bTokens.
|
|
82
|
-
-
|
|
82
|
+
- **Solana**: Backed's xStocks (`TSLAx`), Ondo Global Markets' (`TSLAon`), Backpack Securities'
|
|
83
|
+
(`NVDA_US`, `SPCX_US`) and PreStocks' shares of private companies (`SPACEX`, `OPENAI`), each a
|
|
84
|
+
Token-2022 mint (below).
|
|
83
85
|
|
|
84
86
|
The symbol is the issuer's own ticker for the token, in its case: symbols are case-sensitive, and
|
|
85
|
-
`SPCXC` is not `SPCXc`. A `.` in a ticker is written `_`: `BRK.Bx` is `BRK_Bx
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
`SPCXC` is not `SPCXc`. A `.` in a ticker is written `_`: `BRK.Bx` is `BRK_Bx`, and Backpack's
|
|
88
|
+
`NVDA.US` is `NVDA_US`. PreStocks' symbol is the company's name, `SPACEX`. One company has one token
|
|
89
|
+
per issuer: SpaceX is `SPCXx` and `SPCXon` on Ethereum, `SPCXc` on Base, and `SPCXx`, `SPCXon`,
|
|
90
|
+
`SPCX_US` and `SPACEX` on Solana. Find one by the company's name or ticker with
|
|
91
|
+
`npx sauce globals --chain base --search spacex`, list a chain's with `--stocks`, or read
|
|
92
|
+
[references/stocks.md](references/stocks.md).
|
|
89
93
|
|
|
90
94
|
Buying and selling one on a DEX needs no account with its issuer, and any contract can hold it,
|
|
91
95
|
the program's Pot included; only minting and redeeming with the issuer need KYC. What differs from
|
|
@@ -107,6 +111,40 @@ function main(recipient: Address, amount: Uint256) {
|
|
|
107
111
|
}
|
|
108
112
|
```
|
|
109
113
|
|
|
114
|
+
### On Solana
|
|
115
|
+
|
|
116
|
+
A stock on Solana is a Token-2022 mint, and its symbol is the mint's 32-byte key, a value for
|
|
117
|
+
`@sauce/token`'s functions: `balanceOf(TSLAx, account)`. A program moves one with the checked
|
|
118
|
+
writes, `transferChecked` and `approveChecked`, which take the mint's token program, the mint and
|
|
119
|
+
its decimals beside the token accounts (`transfer` and `approve` take legacy SPL Token mints only).
|
|
120
|
+
`sauce` names each of those accounts by the symbol: `program:TSLAx` the token program,
|
|
121
|
+
`mint:TSLAx` the mint, `pot:TSLAx` the Pot's token account and `owner:TSLAx` the owner's.
|
|
122
|
+
|
|
123
|
+
- Amounts are raw, in the mint's decimals. The issuer's multiplier, by which a wallet shows them,
|
|
124
|
+
moves for splits and dividends, so a raw unit is not always one share.
|
|
125
|
+
- PreStocks' mints charge a transfer fee: the token program keeps part of every transfer, so the
|
|
126
|
+
recipient gets less than was sent. Measure what arrived, as below; the references mark each mint
|
|
127
|
+
that charges one.
|
|
128
|
+
- Every stock mint has a transfer hook that names no program, which is no hook. `@sauce/token`
|
|
129
|
+
refuses a mint whose hook names a program (`transfer hook`), and no registered mint has one.
|
|
130
|
+
- The issuer can pause its mint, and can hold a permanent delegate, which can move or burn any
|
|
131
|
+
balance. A new token account is usable, not frozen.
|
|
132
|
+
|
|
133
|
+
```sauce chain=solana
|
|
134
|
+
function main(
|
|
135
|
+
tokenProgram: Account,
|
|
136
|
+
source: Account<Writable>,
|
|
137
|
+
mint: Account,
|
|
138
|
+
destination: Account<Writable>,
|
|
139
|
+
pot: Account<Signer>,
|
|
140
|
+
amount: Uint256,
|
|
141
|
+
): Uint256 {
|
|
142
|
+
const before = balanceOf(SPACEX, destination);
|
|
143
|
+
transferChecked(SPACEX, tokenProgram, source, mint, destination, pot, amount, 9n);
|
|
144
|
+
return balanceOf(SPACEX, destination) - before;
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
110
148
|
## Protocols
|
|
111
149
|
|
|
112
150
|
- `Namespace.Contract` is the contract's address on the program's chain where a value is expected,
|