ryt-sdk 1.0.0 โ 1.0.1
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/LICENSE +21 -0
- package/README.md +301 -3
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RYT Core Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,8 +1,306 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ๐ RYT SDK
|
|
2
2
|
|
|
3
3
|
RYT blockchain SDK for provider, wallet, and smart contract interactions.
|
|
4
4
|
|
|
5
|
-
## Install
|
|
5
|
+
## โ๏ธ Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install ryt-sdk
|
|
8
|
+
npm install ryt-sdk
|
|
9
|
+
```
|
|
10
|
+
or
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
yarn add ryt-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## ๐ Environment Setup
|
|
17
|
+
|
|
18
|
+
Create a .env file:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
PRIVATE_KEY=your_private_key
|
|
22
|
+
RPC_URL=https://your-rpc-url
|
|
23
|
+
CHAIN_ID=1234
|
|
24
|
+
|
|
25
|
+
TOKEN_URI=https://metadata.example.com
|
|
26
|
+
CREATE2_FACTORY=0xFactoryAddress
|
|
27
|
+
SALT=random_salt
|
|
28
|
+
MATH_LIB_ADDRESS=0xLibraryAddress
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## โก 30-Second Quickstart
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
import RYTProvider from "ryt-sdk/provider";
|
|
35
|
+
import RYTWallet from "ryt-sdk/wallet";
|
|
36
|
+
import RYTContract from "ryt-sdk/contract";
|
|
37
|
+
|
|
38
|
+
const provider = new RYTProvider({
|
|
39
|
+
chainId: process.env.CHAIN_ID,
|
|
40
|
+
rpcUrls: [process.env.RPC_URL]
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const wallet = new RYTWallet(process.env.PRIVATE_KEY, provider);
|
|
44
|
+
|
|
45
|
+
const contract = new RYTContract(address, abi, wallet);
|
|
46
|
+
|
|
47
|
+
const tx = await contract.write("transfer", to, 100n);
|
|
48
|
+
await tx.wait();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## ๐ Overview
|
|
53
|
+
|
|
54
|
+
RYT SDK is a modular blockchain development toolkit designed to simplify:
|
|
55
|
+
|
|
56
|
+
- Smart contract interaction
|
|
57
|
+
- Wallet management
|
|
58
|
+
- Contract deployment (CREATE / CREATE2)
|
|
59
|
+
- ERC20 / ERC721 / ERC1155 support
|
|
60
|
+
- Proxy patterns (UUPS)
|
|
61
|
+
- Cloning (EIP-1167)
|
|
62
|
+
- Library-linked contracts
|
|
63
|
+
|
|
64
|
+
## ๐ง Architecture
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
Your App
|
|
68
|
+
โ
|
|
69
|
+
โผ
|
|
70
|
+
RYT SDK Core
|
|
71
|
+
โโโ Provider
|
|
72
|
+
โโโ Wallet
|
|
73
|
+
โโโ Contract
|
|
74
|
+
โโโ Deployment Engine
|
|
75
|
+
โ
|
|
76
|
+
โผ
|
|
77
|
+
RYT/ Ethereum / EVM Chain
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## ๐งฉ Core Modules
|
|
81
|
+
|
|
82
|
+
#### Provider
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
import RYTProvider from "ryt-sdk/provider";
|
|
86
|
+
|
|
87
|
+
const provider = new RYTProvider({
|
|
88
|
+
chainId: 1234,
|
|
89
|
+
rpcUrls: ["https://rpc-url"]
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Wallet
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
import RYTWallet from "ryt-sdk/wallet";
|
|
97
|
+
|
|
98
|
+
const wallet = new RYTWallet(PRIVATE_KEY, provider);
|
|
99
|
+
|
|
100
|
+
console.log(wallet.getAddress());
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Contract
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
import RYTContract from "ryt-sdk/contract";
|
|
107
|
+
|
|
108
|
+
const contract = new RYTContract(address, abi, wallet);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### ๐ Read Contract Data
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
const name = await contract.read("name");
|
|
115
|
+
const symbol = await contract.read("symbol");
|
|
116
|
+
const decimals = await contract.read("decimals");
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### โ๏ธ Write Transactions
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
const tx = await contract.write("transfer", to, 100n);
|
|
123
|
+
await tx.wait();
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### ๐ช ERC20 Example
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
const token = new RYTContract(address, ERC20.abi, wallet);
|
|
131
|
+
|
|
132
|
+
await token.write("transfer", recipient, 100n);
|
|
133
|
+
await token.write("approve", spender, 100n);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### ๐จ ERC721 Mint
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
const nft = new RYTContract(address, ERC721.abi, wallet);
|
|
141
|
+
|
|
142
|
+
await nft.write("safeMint", wallet.getAddress(), TOKEN_URI);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### ๐งฉ ERC1155 Mint
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
const multi = new RYTContract(address, ERC1155.abi, wallet);
|
|
150
|
+
|
|
151
|
+
await multi.write("mint", wallet.getAddress(), 1, 20);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
### ๐๏ธ Deploy Contracts
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
const contract = await deployer.deploy({
|
|
159
|
+
abi: ERC20.abi,
|
|
160
|
+
bytecode: ERC20.bytecode,
|
|
161
|
+
args: ["My Token", "MTK", 18, 1000000]
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### ๐ญ Factory Deployments
|
|
166
|
+
|
|
167
|
+
#### Master Factory
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
const factory = await deployer.deploy({
|
|
171
|
+
abi: MasterFactory.abi,
|
|
172
|
+
bytecode: MasterFactory.bytecode,
|
|
173
|
+
args: [100]
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Create
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
const tx = await factory.write("deploySimple", 777);
|
|
181
|
+
await tx.wait();
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Create2
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
const tx = await factory.write("deployCreate2", 999, salt);
|
|
188
|
+
await tx.wait();
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Cloning (EIP-1167)
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
const tx = await factory.write("deployClone", childAddr);
|
|
195
|
+
await tx.wait();
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### ๐งฌ Cloning (EIP-1167) without factory
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
const clone = await deployer.deployClone(address);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### ๐ UUPS Proxy
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
const proxy = await deployer.deployUUPS({
|
|
208
|
+
implementationAbi,
|
|
209
|
+
implementationBytecode,
|
|
210
|
+
initData
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
await proxy.write("setValue", 100);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### CREATE2
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
const result = await deployer.deployCreate2({
|
|
220
|
+
factoryAddress: CREATE2_FACTORY,
|
|
221
|
+
abi: ERC20.abi,
|
|
222
|
+
bytecode: ERC20.bytecode,
|
|
223
|
+
salt,
|
|
224
|
+
args: ["My Token", "MTK", 18, 1000000]
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### ๐ฆ Library Linking
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
const lib = await deployer.deployWithLibraries({
|
|
232
|
+
abi: Calculator.abi,
|
|
233
|
+
bytecode: Calculator.bytecode,
|
|
234
|
+
linkReferences: {
|
|
235
|
+
"contracts/ryt/MathLib.sol": {
|
|
236
|
+
MathLib: [{ length: 20, start: 283 }]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
libraries: {
|
|
240
|
+
MathLib: MATH_LIB_ADDRESS
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## ๐จ Error Handling
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
try {
|
|
249
|
+
await contract.write("transfer", to, amount);
|
|
250
|
+
} catch (err) {
|
|
251
|
+
console.error(err);
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## ๐ Feature Support
|
|
256
|
+
|
|
257
|
+
| Category | Feature | Status | Description |
|
|
258
|
+
|----------------------|------------------------|--------|-------------|
|
|
259
|
+
| Core | Provider | โ
| RPC connection & chain interaction layer |
|
|
260
|
+
| Core | Wallet | โ
| Private key management & signing |
|
|
261
|
+
| Core | Contract Read/Write | โ
| Unified smart contract interaction API |
|
|
262
|
+
| Tokens | ERC20 | โ
| Fungible token standard support |
|
|
263
|
+
| Tokens | ERC721 | โ
| NFT (non-fungible token) support |
|
|
264
|
+
| Tokens | ERC1155 | โ
| Multi-token standard support |
|
|
265
|
+
| Deployment | CREATE | โ
| Standard contract deployment |
|
|
266
|
+
| Deployment | CREATE2 | โ
| Deterministic contract deployment |
|
|
267
|
+
| Proxy Systems | UUPS Proxy | โ
| Upgradeable contract architecture |
|
|
268
|
+
| Proxy Systems | Cloning (EIP-1167) | โ
| Minimal proxy factory cloning |
|
|
269
|
+
| Advanced | Library Linking | โ
| Solidity library linking support |
|
|
270
|
+
| Advanced | Internal Transactions | โ
| Internal execution tracing support |
|
|
271
|
+
| Advanced | Payable Functions | โ
| ETH value transfer support |
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
## ๐งช Full Test Suite
|
|
275
|
+
|
|
276
|
+
To run tests, run the following command
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
npm test
|
|
280
|
+
npm run contractsTest
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Includes:
|
|
284
|
+
|
|
285
|
+
- ERC20 / ERC721 / ERC1155
|
|
286
|
+
- CREATE / CREATE2 deployments
|
|
287
|
+
- Proxy patterns (UUPS)
|
|
288
|
+
- Cloning (EIP-1167)
|
|
289
|
+
- Payable functions
|
|
290
|
+
- Library linking
|
|
291
|
+
- Internal transaction validation
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## ๐ Why RYT SDK?
|
|
295
|
+
|
|
296
|
+
- ๐งฉ Modular blockchain architecture
|
|
297
|
+
- ๐๏ธ Supports advanced EVM patterns
|
|
298
|
+
- ๐ง Designed for real-world production systems
|
|
299
|
+
- ๐ Works with any EVM chain
|
|
300
|
+
|
|
301
|
+
## ๐ License
|
|
302
|
+
|
|
303
|
+
[](https://choosealicense.com/licenses/mit/)ยฉ 2026 RYT Core Team
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+

|
package/package.json
CHANGED