Skip to content

Commit 576d613

Browse files
chore: wip
1 parent 4f19a91 commit 576d613

File tree

126 files changed

+690
-650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+690
-650
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@
100100

101101
## ...main
102102

103-
104103
### 📖 Documentation
105104

106105
- Several minor updates ([877a7d2](https://github.com/stacksjs/qrx/commit/877a7d2))
@@ -118,4 +117,3 @@
118117
### ❤️ Contributors
119118

120119
- Chris ([@chrisbbreuer](http://github.com/chrisbbreuer))
121-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export default defineConfig({
160160
- [CLI Reference](https://ts-tokens.dev/cli)
161161
- [API Reference](https://ts-tokens.dev/api)
162162

163-
## Why ts-tokens?
163+
## Why ts-tokens
164164

165165
**Zero External Dependencies**: Unlike Metaplex SDKs, ts-tokens only depends on official Solana packages (`@solana/web3.js`, `@solana/spl-token`). We implement all program interactions using raw instructions.
166166

TODO.md

Lines changed: 118 additions & 118 deletions
Large diffs are not rendered by default.

docs/api/candy-machine/manage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const progress = {
153153
total: Number(cm.itemsAvailable),
154154
minted: Number(cm.itemsRedeemed),
155155
remaining: Number(cm.itemsAvailable - cm.itemsRedeemed),
156-
percentage: Number((cm.itemsRedeemed * 100n) / cm.itemsAvailable),
156+
percentage: Number((cm.itemsRedeemed _ 100n) / cm.itemsAvailable),
157157
}
158158

159159
console.log(`Progress: ${progress.minted}/${progress.total} (${progress.percentage}%)`)
@@ -166,7 +166,7 @@ const cm = await getCandyMachine(address, config)
166166
const price = 1_000_000_000n // 1 SOL
167167

168168
const revenue = {
169-
total: Number(cm.itemsRedeemed) * Number(price) / 1e9,
169+
total: Number(cm.itemsRedeemed) _ Number(price) / 1e9,
170170
currency: 'SOL',
171171
}
172172

docs/api/staking/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const pool = await createStakingPool({
2525
stakeMint: tokenMint,
2626
rewardMint: rewardTokenMint,
2727
rewardRate: 1_000_000n, // rewards per second
28-
rewardDuration: 30n * 24n * 60n * 60n, // 30 days
29-
minStakeDuration: 7n * 24n * 60n * 60n, // 7 day lock
28+
rewardDuration: 30n _ 24n _ 60n _ 60n, // 30 days
29+
minStakeDuration: 7n _ 24n _ 60n _ 60n, // 7 day lock
3030
earlyUnstakePenalty: 1000, // 10% penalty
3131
}, config)
3232
```
@@ -41,7 +41,7 @@ const config = await getConfig()
4141
await stake({
4242
pool: poolAddress,
4343
amount: 1000_000_000_000n, // 1000 tokens
44-
lockDuration: 30n * 24n * 60n * 60n, // 30 days
44+
lockDuration: 30n _ 24n _ 60n _ 60n, // 30 days
4545
}, config)
4646
```
4747

@@ -121,7 +121,7 @@ const config = await getConfig()
121121
const info = await getNFTStakeInfo(stakeAccount, config)
122122

123123
console.log('Points earned:', info.pointsEarned)
124-
console.log('Staked at:', new Date(Number(info.stakedAt) * 1000))
124+
console.log('Staked at:', new Date(Number(info.stakedAt) _ 1000))
125125
```
126126

127127
### Unstake NFT
@@ -184,18 +184,18 @@ Rewards are calculated using a checkpoint system:
184184

185185
```
186186
rewardPerToken = rewardPerTokenStored + (
187-
(currentTime - lastUpdateTime) * rewardRate / totalStaked
187+
(currentTime - lastUpdateTime) _ rewardRate / totalStaked
188188
)
189189
190-
earned = (stakedAmount * (rewardPerToken - userRewardPerTokenPaid)) + rewardsEarned
190+
earned = (stakedAmount _ (rewardPerToken - userRewardPerTokenPaid)) + rewardsEarned
191191
```
192192

193193
## Early Unstake Penalty
194194

195195
If unstaking before lock period ends:
196196

197197
```
198-
penalty = amount * (remainingLockTime / totalLockTime) * penaltyBps / 10000
198+
penalty = amount _ (remainingLockTime / totalLockTime) _ penaltyBps / 10000
199199
```
200200

201201
## Related

docs/api/tokens/metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Add and manage metadata for fungible tokens.
44

5-
## Why Token Metadata?
5+
## Why Token Metadata
66

77
Metadata allows tokens to display properly in wallets and explorers:
88

docs/architecture.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,26 @@ ts-tokens/
150150
## Design Principles
151151

152152
1. **Zero SDK Dependencies** -- All on-chain program interactions use raw
153+
153154
`TransactionInstruction` builders from `@solana/web3.js`. No Metaplex,
154155
Serum, or other external SDKs are included.
155156

156157
2. **Driver Abstraction** -- The `ChainDriver` interface in `types/driver.ts`
158+
157159
defines a chain-agnostic API. Currently only Solana is implemented, but
158160
the registry pattern supports future chains.
159161

160162
3. **Storage Adapter Pattern** -- All storage providers implement the
163+
161164
`StorageAdapter` interface. A factory function auto-selects the adapter
162165
from config, and a fallback chain tries providers in order.
163166

164167
4. **Layered Architecture** -- Types and config sit at the bottom, programs
168+
165169
and drivers in the middle, high-level modules on top, and fluent/CLI at
166170
the surface. Dependencies flow downward only.
167171

168172
5. **Barrel Exports** -- Each module has an `index.ts` that re-exports its
173+
169174
public API. The top-level `src/index.ts` re-exports everything for
170175
consumers who want a single import path.

docs/cli/nft.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ NFT Info:
7474
Collection: DEF456...
7575
Royalty: 5%
7676
Creators:
77+
7778
- ABC123... (100%)
79+
7880
```
7981

8082
## `tokens nft:list`
@@ -90,9 +92,11 @@ tokens nft:list --owner <address>
9092

9193
```text
9294
NFTs (3 total):
95+
9396
1. Cool NFT #1 (ABC123...)
9497
2. Cool NFT #2 (DEF456...)
9598
3. Rare Item (GHI789...)
99+
96100
```
97101

98102
## `tokens collection:create`

docs/config.md

Lines changed: 80 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,86 +10,126 @@ import path from 'node:path'
1010

1111
const config: tokensConfig = {
1212
/**
13-
* The type of the QR code.
14-
*/
13+
14+
_ The type of the QR code.
15+
16+
_/
1517
type: 'qr', // 'qr' | 'bar'
1618
1719
options: {
1820
/**
19-
* The width of the QR code.
20-
*/
21+
22+
_ The width of the QR code.
23+
24+
_/
2125
width: 2,
2226
/**
23-
* The height of the QR code.
24-
*/
27+
28+
_ The height of the QR code.
29+
30+
_/
2531
height: 100,
2632
/**
27-
* The format of the QR code.
28-
*/
33+
34+
_ The format of the QR code.
35+
36+
_/
2937
format: 'auto',
3038
/**
31-
* Whether to display the value in the QR code.
32-
*/
39+
40+
_ Whether to display the value in the QR code.
41+
42+
_/
3343
displayValue: true,
3444
/**
35-
* The font options for the QR code.
36-
*/
45+
46+
_ The font options for the QR code.
47+
48+
_/
3749
fontOptions: '',
3850
/**
39-
* The font for the QR code.
40-
*/
51+
52+
_ The font for the QR code.
53+
54+
_/
4155
font: 'monospace',
4256
/**
43-
* The text for the QR code.
44-
*/
57+
58+
_ The text for the QR code.
59+
60+
_/
4561
text: undefined,
4662
/**
47-
* The text alignment for the QR code.
48-
*/
63+
64+
_ The text alignment for the QR code.
65+
66+
_/
4967
textAlign: 'center', // 'left' | 'center' | 'right'
5068
/**
51-
* The text position for the QR code.
52-
*/
69+
70+
_ The text position for the QR code.
71+
72+
_/
5373
textPosition: 'bottom', // 'top' | 'bottom' | 'left' | 'right'
5474
/**
55-
* The text margin for the QR code.
56-
*/
75+
76+
_ The text margin for the QR code.
77+
78+
_/
5779
textMargin: 2,
5880
/**
59-
* The font size for the QR code.
60-
*/
81+
82+
_ The font size for the QR code.
83+
84+
_/
6185
fontSize: 20,
6286
/**
63-
* The background color for the QR code.
64-
*/
87+
88+
_ The background color for the QR code.
89+
90+
_/
6591
background: '#ffffff',
6692
/**
67-
* The line color for the QR code.
68-
*/
93+
94+
_ The line color for the QR code.
95+
96+
_/
6997
lineColor: '#000000',
7098
/**
71-
* The margin for the QR code.
72-
*/
99+
100+
_ The margin for the QR code.
101+
102+
_/
73103
margin: 10,
74104
/**
75-
* The margin top for the QR code.
76-
*/
105+
106+
_ The margin top for the QR code.
107+
108+
_/
77109
marginTop: undefined,
78110
/**
79-
* The margin right for the QR code.
80-
*/
111+
112+
_ The margin right for the QR code.
113+
114+
_/
81115
marginBottom: undefined,
82116
/**
83-
* The margin left for the QR code.
84-
*/
117+
118+
_ The margin left for the QR code.
119+
120+
_/
85121
marginLeft: undefined,
86122
/**
87-
* The margin right for the QR code.
88-
*/
123+
124+
_ The margin right for the QR code.
125+
126+
_/
89127
marginRight: undefined,
90128
/**
91-
* The error correction level for the QR code.
92-
*/
129+
130+
_ The error correction level for the QR code.
131+
132+
_/
93133
valid() { },
94134
},
95135
}

docs/guides/api-differences.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
### 1. No Global Instance
1616

1717
Metaplex SDK uses a global instance pattern:
18+
1819
```typescript
1920
// Metaplex SDK
2021
const metaplex = Metaplex.make(connection).use(keypairIdentity(wallet))
2122
const nft = await metaplex.nfts().findByMint(...)
2223
```
2324

2425
ts-tokens passes config to each function:
26+
2527
```typescript
2628
// ts-tokens
2729
const config = { rpcUrl, keypair }
@@ -31,6 +33,7 @@ const nft = await getNFTMetadata(mint, config)
3133
### 2. String Addresses
3234

3335
Metaplex SDK requires `PublicKey` objects everywhere. ts-tokens accepts plain strings:
36+
3437
```typescript
3538
// Metaplex SDK
3639
const mint = new PublicKey('...')
@@ -43,13 +46,15 @@ await getNFTMetadata('...', config)
4346
### 3. Built-in Batch Operations
4447

4548
ts-tokens includes native batch support:
49+
4650
```typescript
4751
import { batchUpdateNFTMetadata, batchVerifyCollection, batchBurnNFTs } from 'ts-tokens/legacy'
4852
```
4953

5054
### 4. DAS API Integration
5155

5256
ts-tokens can use DAS API for faster queries:
57+
5358
```typescript
5459
import { getNFTsInCollection } from 'ts-tokens/legacy'
5560
// Automatically uses DAS when available, falls back to on-chain
@@ -59,6 +64,7 @@ const nfts = await getNFTsInCollection(collection, config, { useDAS: true })
5964
### 5. Collection Discovery
6065

6166
ts-tokens adds discovery capabilities not in Metaplex SDK:
67+
6268
```typescript
6369
import { discoverCollectionByCreator, discoverCollectionByCandyMachine } from 'ts-tokens/legacy'
6470
```

0 commit comments

Comments
 (0)