@raac/rpc 1.1.0-beta.30 → 1.1.0-beta.31

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.
@@ -158,6 +158,7 @@ class RPCLibrary {
158
158
  mintAsset: mintAsset_1.default,
159
159
  burnAsset: burnAsset_1.default,
160
160
  },
161
+ rpcs: {},
161
162
  };
162
163
  this.nfts = {
163
164
  getBaseUri: getBaseUri_1.default,
@@ -57,26 +57,26 @@
57
57
  "rwavault": {
58
58
  "id": "rwavault",
59
59
  "name": "RWA Vault",
60
- "contract": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E"
60
+ "contract": "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F"
61
61
  }
62
62
  },
63
63
  "pools": {
64
64
  "stabilitypool": {
65
65
  "id": "stabilitypool",
66
66
  "name": "Stability Pool",
67
- "contract": "0x09635F643e140090A9A8Dcd712eD6285858ceBef"
67
+ "contract": "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"
68
68
  },
69
69
  "lendingpool": {
70
70
  "id": "lendingpool",
71
71
  "name": "Lending Pool",
72
- "contract": "0x59b670e9fA9D0A427751Af201D676719a970857b"
72
+ "contract": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
73
73
  }
74
74
  },
75
75
  "nfts": {
76
76
  "raacnft": {
77
77
  "id": "raacnft",
78
78
  "name": "RAAC NFT",
79
- "contract": "0xf5059a5D33d5853360D16C683c16e67980206f36"
79
+ "contract": "0x9E545E3C0baAB3E08CdfD552C960A1050f373042"
80
80
  }
81
81
  },
82
82
  "assets": {
@@ -96,13 +96,13 @@
96
96
  "id": "rtoken",
97
97
  "name": "RToken",
98
98
  "decimals": 18,
99
- "contract": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
99
+ "contract": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
100
100
  },
101
101
  "detoken": {
102
102
  "id": "detoken",
103
103
  "name": "DEToken",
104
104
  "decimals": 18,
105
- "contract": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319"
105
+ "contract": "0x59b670e9fA9D0A427751Af201D676719a970857b"
106
106
  },
107
107
  "raactoken": {
108
108
  "id": "raactoken",
@@ -120,13 +120,13 @@
120
120
  "id": "debttoken",
121
121
  "name": "Debt Token",
122
122
  "decimals": 18,
123
- "contract": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed"
123
+ "contract": "0x9A676e781A523b5d0C0e43731313A708CB607508"
124
124
  },
125
125
  "rwaindextoken": {
126
126
  "id": "rwaindextoken",
127
127
  "name": "Index Token",
128
128
  "decimals": 18,
129
- "contract": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933"
129
+ "contract": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319"
130
130
  }
131
131
  },
132
132
  "adapters": {
@@ -134,7 +134,7 @@
134
134
  "raacnftadapter": {
135
135
  "id": "raacnftadapter",
136
136
  "name": "RAAC NFT Adapter",
137
- "contract": "0x998abeb3E57409262aE5b751f60747921B33613E",
137
+ "contract": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
138
138
  "type": "ERC721"
139
139
  },
140
140
  "rwaindextokenadapter": {
@@ -148,13 +148,13 @@
148
148
  "raacnftadapter": {
149
149
  "id": "raacnftadapter",
150
150
  "name": "RAAC NFT Adapter",
151
- "contract": "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
151
+ "contract": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
152
152
  "type": "ERC721"
153
153
  },
154
154
  "crvusdadapter": {
155
155
  "id": "crvusdadapter",
156
156
  "name": "CRVUSD Adapter",
157
- "contract": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
157
+ "contract": "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
158
158
  "type": "ERC20"
159
159
  }
160
160
  }
@@ -9,7 +9,7 @@ const chains_1 = __importDefault(require("../configs/chains"));
9
9
  const RPCLibrary_1 = __importDefault(require("../RPCLibrary"));
10
10
  const contracts_1 = require("../utils/contracts");
11
11
  const artifacts_1 = require("../utils/artifacts");
12
- const chainId = 11155111;
12
+ const chainId = 8453;
13
13
  const config = chains_1.default[chainId];
14
14
  const TEST_MNEMONIC = process.env.TEST_MNEMONIC;
15
15
  const TEST_PRIVATE_KEY = process.env.TEST_PRIVATE_KEY;
@@ -17,14 +17,16 @@ async function getProvider() {
17
17
  return new ethers_1.ethers.JsonRpcProvider(config.rpcs[0]);
18
18
  }
19
19
  async function createWallet(mnemonic, provider) {
20
- // const wallet = ethers.Wallet.fromPhrase(mnemonic, provider);
21
- // console.info(`[${chainId}]: Loaded wallet from mnemonic: ${wallet.address}`);
22
- // // the signer is the wallet
23
- // return wallet;
24
- // load from private key
25
- const wallet = new ethers_1.ethers.Wallet(TEST_PRIVATE_KEY, provider);
26
- console.info(`[${chainId}]: Loaded wallet from private key: ${wallet.address}`);
20
+ const wallet = ethers_1.ethers.Wallet.fromPhrase(mnemonic, provider);
21
+ console.info(`[${chainId}]: Loaded wallet from mnemonic: ${wallet.address}`);
22
+ // the signer is the wallet
27
23
  return wallet;
24
+ // load from private key
25
+ // const wallet = new ethers.Wallet(TEST_PRIVATE_KEY, provider);
26
+ // console.info(
27
+ // `[${chainId}]: Loaded wallet from private key: ${wallet.address}`
28
+ // );
29
+ // return wallet;
28
30
  }
29
31
  async function setup() {
30
32
  const provider = await getProvider();
@@ -34,37 +36,16 @@ async function setup() {
34
36
  rpc.provider = provider;
35
37
  rpc.chainId = chainId;
36
38
  // // send myself some CRVUSD
37
- // await rpc.wallet.assets.mintAsset(
38
- // chainId,
39
- // "crvusd",
40
- // 10000000n,
41
- // signer.address,
42
- // signer
43
- // );
44
- // // // set the base uri to instruxi data gateway
45
- // await rpc.nfts.setBaseUri(
46
- // chainId,
47
- // "http://44.211.155.244:3000/v1/properties/",
48
- // signer
49
- // );
39
+ await rpc.wallet.assets.mintAsset(chainId, "crvusd", 10000000n, signer.address, signer);
40
+ // // set the base uri to instruxi data gateway
41
+ await rpc.nfts.setBaseUri(chainId, "http://44.211.155.244:3000/v1/properties/", signer);
42
+ console.log(await rpc.pools.lendingPool.getLendingPoolInfo(chainId, signer.address, provider));
43
+ console.log(await rpc.wallet.assets.getBalance(chainId, "rtoken", signer.address, provider));
50
44
  // console.log(
51
- // await rpc.pools.lendingPool.getLendingPoolInfo(
52
- // chainId,
53
- // signer.address,
54
- // provider
55
- // )
45
+ // await rpc.nfts.getTokensByOwner(chainId, signer.address, provider)
56
46
  // );
57
- // console.log(
58
- // await rpc.wallet.assets.getBalance(
59
- // chainId,
60
- // "rtoken",
61
- // signer.address,
62
- // provider
63
- // )
64
- // );
65
- console.log(await rpc.nfts.getTokensByOwner(chainId, signer.address, provider));
66
47
  // // // set the oracle address of the RAACHousePrice. TEmporarily simulating that I AM THE ORACLE
67
- // await rpc.contracts.housePrices.setOracle(chainId, signer.address, signer);
48
+ await rpc.contracts.housePrices.setOracle(chainId, signer.address, signer);
68
49
  // // // // // set price for 3 houses
69
50
  const housePriceAddress = (0, contracts_1.getContractAddress)(chainId, "raachouseprices");
70
51
  const housePriceABI = (0, artifacts_1.getABI)("raachouseprices");
@@ -74,45 +55,38 @@ async function setup() {
74
55
  const raacNFTContract = new ethers_1.ethers.Contract(raacNFTAddress, raacNFTABI, signer);
75
56
  const countTokens = 3;
76
57
  // // // // Generate 10 house prices between 100K and 2M
77
- // const housePrices = [];
78
- // for (let i = 1; i <= countTokens; i++) {
79
- // const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
80
- // housePrices.push(price);
81
- // }
82
- // // // set house prices with proper error handling and gas management
83
- // for (const item of housePrices.map((price, index) => ({ id: index + 3, price: parseEther(price.toString()) }))) {
84
- // try {
85
- // // Get the current gas price and add a small increment
86
- // const gasPrice = await provider.getGasPrice();
87
- // const tx = await housePriceContract.setHousePrice(item.id, item.price, {
88
- // gasPrice: gasPrice.add(1000000), // Add a small increment to gas price
89
- // gasLimit: 300000 // Set a specific gas limit
90
- // });
91
- // // Wait for the transaction to be mined
92
- // const receipt = await tx.wait();
93
- // console.log("Price set for house", item.id, "tx:", receipt.hash);
94
- // // Add a delay between transactions
95
- // await new Promise(resolve => setTimeout(resolve, 2000));
96
- // } catch (error) {
97
- // console.error(`Failed to set price for house ${item.id}:`, error);
98
- // // Continue with the next item instead of stopping
99
- // continue;
100
- // }
101
- // }
102
- // // confirm the house prices are set
103
- // for (let i = 1; i <= countTokens; i++) {
104
- // const price = await rpc.nfts.getHousePrice(chainId, i, provider);
105
- // console.log("Price for house", i, price);
106
- // if (price !== housePrices[i - 1].toString() + ".0") {
107
- // throw new Error("Price not set correctly");
108
- // }
109
- // }
110
- // // // // Mint the new properties
111
- // for (let i = 1; i <= countTokens; i++) {
112
- // const tx = await raacNFTContract.minterMint(signer.address, i);
113
- // await tx.wait();
114
- // console.log("Minted NFT", i);
115
- // }
58
+ const housePrices = [];
59
+ for (let i = 1; i <= countTokens; i++) {
60
+ const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
61
+ housePrices.push(price);
62
+ }
63
+ // // // Mint the new properties
64
+ for (let i = 1; i <= countTokens; i++) {
65
+ const tx = await raacNFTContract.minterMint(signer.address, i);
66
+ await tx.wait();
67
+ console.log("Minted NFT", i);
68
+ }
69
+ // // set house prices
70
+ for (let i = 1; i <= countTokens; i++) {
71
+ const tx = await housePriceContract.setHousePrice(i, (0, ethers_1.parseEther)(housePrices[i - 1].toString()));
72
+ await tx.wait();
73
+ console.log("Price set for house", i);
74
+ }
75
+ for (let i = 1; i <= countTokens; i++) {
76
+ const price = await rpc.nfts.getHousePrice(chainId, i, provider);
77
+ console.log("Price for house", i, price);
78
+ if (price !== housePrices[i - 1].toString() + ".0") {
79
+ throw new Error("Price not set correctly");
80
+ }
81
+ }
82
+ let nftIdStart = countTokens + 1;
83
+ let nftIdEnd = countTokens + 10;
84
+ for (let i = nftIdStart; i <= nftIdEnd; i++) {
85
+ const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
86
+ const tx = await housePriceContract.setHousePrice(i, (0, ethers_1.parseEther)(price.toString()));
87
+ await tx.wait();
88
+ console.log("Price set for house", i);
89
+ }
116
90
  // Generate some random NFT and set price only: not purchased yet
117
91
  // let nftIdStart = countTokens + 2;
118
92
  // let nftIdEnd = countTokens + 10;
@@ -114,6 +114,7 @@ declare class RPCLibrary {
114
114
  mintAsset: typeof mintAsset;
115
115
  burnAsset: typeof burnAsset;
116
116
  };
117
+ rpcs: {};
117
118
  };
118
119
  nfts: {
119
120
  getBaseUri: typeof getBaseUri;
@@ -1,15 +1,15 @@
1
- import { Chain8453, Chain11155111 } from "./chain";
1
+ import { Chain8453 } from "./chain";
2
2
  declare const chains: {
3
3
  8453: Chain8453;
4
4
  17000: Chain8453;
5
- 11155111: Chain11155111;
5
+ 11155111: Chain8453;
6
6
  18453: Chain8453;
7
7
  };
8
8
  export default chains;
9
9
  export declare const configs: {
10
10
  8453: Chain8453;
11
11
  17000: Chain8453;
12
- 11155111: Chain11155111;
12
+ 11155111: Chain8453;
13
13
  18453: Chain8453;
14
14
  };
15
15
  export type Configs = typeof chains;
@@ -2,7 +2,7 @@ import { ChainId } from "./chains/index";
2
2
  declare function getChainsConfig(): {
3
3
  8453: import("./chains/chain").Chain8453;
4
4
  17000: import("./chains/chain").Chain8453;
5
- 11155111: import("./chains/chain").Chain11155111;
5
+ 11155111: import("./chains/chain").Chain8453;
6
6
  18453: import("./chains/chain").Chain8453;
7
7
  };
8
8
  declare function setChainConfig(chainId: ChainId, config: any): void;
@@ -4,7 +4,7 @@ import { ethers, Provider } from "ethers";
4
4
  export declare const getConfigs: () => {
5
5
  8453: import("../configs/chains/chain").Chain8453;
6
6
  17000: import("../configs/chains/chain").Chain8453;
7
- 11155111: import("../configs/chains/chain").Chain11155111;
7
+ 11155111: import("../configs/chains/chain").Chain8453;
8
8
  18453: import("../configs/chains/chain").Chain8453;
9
9
  };
10
10
  export declare const setOverrideConfig: (chainId: ChainId, newConfig: any) => void;
@@ -19,7 +19,7 @@ declare const _default: {
19
19
  getConfigs: () => {
20
20
  8453: import("../configs/chains/chain").Chain8453;
21
21
  17000: import("../configs/chains/chain").Chain8453;
22
- 11155111: import("../configs/chains/chain").Chain11155111;
22
+ 11155111: import("../configs/chains/chain").Chain8453;
23
23
  18453: import("../configs/chains/chain").Chain8453;
24
24
  };
25
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raac/rpc",
3
- "version": "1.1.0-beta.30",
3
+ "version": "1.1.0-beta.31",
4
4
  "description": "RPC Library for RAAC ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",