ryt-sdk 1.0.10 → 1.0.11
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/dist/contract.js +74 -2
- package/package.json +1 -3
package/dist/contract.js
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
2
|
import RYTWallet from "./wallet";
|
|
3
|
-
|
|
3
|
+
const ERC1967_PROXY_ABI = [
|
|
4
|
+
{
|
|
5
|
+
"inputs": [
|
|
6
|
+
{
|
|
7
|
+
"internalType": "address",
|
|
8
|
+
"name": "implementation",
|
|
9
|
+
"type": "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"internalType": "bytes",
|
|
13
|
+
"name": "_data",
|
|
14
|
+
"type": "bytes"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"stateMutability": "payable",
|
|
18
|
+
"type": "constructor"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"inputs": [
|
|
22
|
+
{
|
|
23
|
+
"internalType": "address",
|
|
24
|
+
"name": "target",
|
|
25
|
+
"type": "address"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"name": "AddressEmptyCode",
|
|
29
|
+
"type": "error"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"inputs": [
|
|
33
|
+
{
|
|
34
|
+
"internalType": "address",
|
|
35
|
+
"name": "implementation",
|
|
36
|
+
"type": "address"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"name": "ERC1967InvalidImplementation",
|
|
40
|
+
"type": "error"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"inputs": [],
|
|
44
|
+
"name": "ERC1967NonPayable",
|
|
45
|
+
"type": "error"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"inputs": [],
|
|
49
|
+
"name": "ERC1967ProxyUninitialized",
|
|
50
|
+
"type": "error"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"inputs": [],
|
|
54
|
+
"name": "FailedCall",
|
|
55
|
+
"type": "error"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"anonymous": false,
|
|
59
|
+
"inputs": [
|
|
60
|
+
{
|
|
61
|
+
"indexed": true,
|
|
62
|
+
"internalType": "address",
|
|
63
|
+
"name": "implementation",
|
|
64
|
+
"type": "address"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"name": "Upgraded",
|
|
68
|
+
"type": "event"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"stateMutability": "payable",
|
|
72
|
+
"type": "fallback"
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
const ERC1967_PROXY_BYTECODE = "0x60806040526040516103b63803806103b683398101604081905261002291610238565b8051610041576040516330a289cf60e21b815260040160405180910390fd5b61004b8282610052565b5050610307565b61005b826100b0565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156100a45761009f828261012b565b505050565b6100ac6101cc565b5050565b806001600160a01b03163b5f036100ea57604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f61013884846101ed565b905080801561015957505f3d118061015957505f846001600160a01b03163b115b1561016e57610166610200565b9150506101c6565b801561019857604051639996b31560e01b81526001600160a01b03851660048201526024016100e1565b3d156101ab576101a6610219565b6101c4565b60405163d6bda27560e01b815260040160405180910390fd5b505b92915050565b34156101eb5760405163b398979f60e01b815260040160405180910390fd5b565b5f5f5f835160208501865af49392505050565b6040513d81523d5f602083013e3d602001810160405290565b6040513d5f823e3d81fd5b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215610249575f5ffd5b82516001600160a01b038116811461025f575f5ffd5b60208401519092506001600160401b0381111561027a575f5ffd5b8301601f8101851361028a575f5ffd5b80516001600160401b038111156102a3576102a3610224565b604051601f8201601f19908116603f011681016001600160401b03811182821017156102d1576102d1610224565b6040528181528282016020018710156102e8575f5ffd5b8160208401602083015e5f602083830101528093505050509250929050565b60a3806103135f395ff3fe6080604052600a600c565b005b60186014601a565b6050565b565b5f604b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b365f5f375f5f365f845af43d5f5f3e8080156069573d5ff35b3d5ffdfea26469706673582212200f18014ea5c0066d8797ddb2f8a13e8798e6d2e79c2d6de92e1ead588a58c3b764736f6c634300081f0033"; // (full bytecode)
|
|
4
76
|
/**
|
|
5
77
|
* -----------------------------
|
|
6
78
|
* Internal helper: Link libraries into bytecode
|
|
@@ -191,7 +263,7 @@ export default class RYTContract {
|
|
|
191
263
|
const impl = await implFactory.deploy();
|
|
192
264
|
await impl.waitForDeployment();
|
|
193
265
|
const implAddress = impl.target;
|
|
194
|
-
const proxyFactory = new ethers.ContractFactory(
|
|
266
|
+
const proxyFactory = new ethers.ContractFactory(ERC1967_PROXY_ABI, ERC1967_PROXY_BYTECODE, signer);
|
|
195
267
|
const proxy = await proxyFactory.deploy(implAddress, options.initData ?? "0x");
|
|
196
268
|
await proxy.waitForDeployment();
|
|
197
269
|
return new RYTContract(proxy.target, options.implementationAbi, this.wallet);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ryt-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.11",
|
|
5
5
|
"description": "RYT blockchain SDK for provider, wallet, and smart contract interactions",
|
|
6
6
|
"author": "Muhammad Hammad Mubeen",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,8 +46,6 @@
|
|
|
46
46
|
"ethers": "^6.8.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@openzeppelin/contracts": "^5.4.0",
|
|
50
|
-
"@openzeppelin/contracts-upgradeable": "^5.4.0",
|
|
51
49
|
"@types/node": "^20.0.0",
|
|
52
50
|
"eslint": "^8.0.0",
|
|
53
51
|
"prettier": "^2.8.0",
|