sacredrealm-sdk 1.0.1 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sacredrealm-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "@walletconnect/web3-provider": "^1.7.5",
24
24
  "ethers": "^5.6.1",
25
25
  "graphql": "^16.3.0",
26
- "sacredrealm-core": "^1.0.1"
26
+ "sacredrealm-core": "^1.0.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "tsdx": "^0.14.1"
package/src/constant.ts CHANGED
@@ -7,6 +7,7 @@ export function token(env?: string) {
7
7
  ST: '0x',
8
8
  SR: '0x',
9
9
  BUSD: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56',
10
+ WBNB: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
10
11
  }
11
12
  } else {
12
13
  return {
@@ -14,7 +15,8 @@ export function token(env?: string) {
14
15
  SN: '0x',
15
16
  ST: '0x',
16
17
  SR: '0x',
17
- BUSD: '0x6Cbb3Ef5A8c9743a1e2148d6DCA69f3ba26BC8C5',
18
+ BUSD: '0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7',
19
+ WBNB: '0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd',
18
20
  };
19
21
  }
20
22
  };
@@ -23,10 +25,12 @@ export function contract(env?: string) {
23
25
  const environment = env || process.env.NODE_ENV;
24
26
  if (environment === 'production') {
25
27
  return {
28
+ BondDepository: '0x',
26
29
  PancakeRouter: '0x10ED43C718714eb63d5aA57B78B54704E256024E',
27
30
  };
28
31
  } else {
29
32
  return {
33
+ BondDepository: '0x',
30
34
  PancakeRouter: '0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3',
31
35
  };
32
36
  }
package/src/index.ts CHANGED
@@ -1,2 +1,4 @@
1
+ export * from './pool';
1
2
  export * from './token';
2
- export * from './constant';
3
+ export * from './constant';
4
+ export * from './utils';
@@ -0,0 +1,7 @@
1
+ import { BondDepository__factory } from 'sacredrealm-core/typechain-types'
2
+ import { rpcProvider } from '../utils';
3
+ import { contract } from '../constant';
4
+
5
+ export function bondDepository() {
6
+ return BondDepository__factory.connect(contract().BondDepository, rpcProvider);
7
+ }
@@ -0,0 +1 @@
1
+ export * from './BondDepository';
package/src/utils.ts CHANGED
@@ -4,6 +4,7 @@ import { token, network } from './constant';
4
4
 
5
5
  export const util = utils;
6
6
  export const constant = constants;
7
+ export const bn = BigNumber;
7
8
 
8
9
  export const rpcProvider = new ethers.providers.JsonRpcProvider(network().rpcUrls[0]);
9
10
  let web3Provider = newWeb3Provider(localStorage.getItem('walletType'));
@@ -101,3 +102,23 @@ export function getSigner() {
101
102
  export function getRandomNumber(snId: number, slot: string, base: number, range: number) {
102
103
  return BigNumber.from(utils.solidityKeccak256(['uint256', 'string'], [snId, slot])).mod(range).add(base).toNumber();
103
104
  }
105
+
106
+ export function getSourceUrl(attr: number[]) {
107
+ const cdn = '//cdn.sealemlab.com/nft';
108
+
109
+ const starArr = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11'];
110
+ const snClassArr = ['Gl', 'As', 'Wi', 'Fi'];
111
+ const placeArr = ['Wp', 'Hair', 'Upper', 'Arm', 'Leg', 'Belt', 'Neck', 'Ring'];
112
+ const suitArr = ['01', '02', '03', '04'];
113
+
114
+ const star = starArr[attr[0] - 1];
115
+ const snClass = snClassArr[attr[2] - 1];
116
+ const place = placeArr[attr[3] - 1];
117
+ const suit = suitArr[attr[4] - 1];
118
+
119
+ if (attr[3] >= 6) {
120
+ return `${cdn}/${snClass}/TEX_ACC_${snClass}_A_${place}_${suit}`;
121
+ } else {
122
+ return `${cdn}/${snClass}/TEX_PC_${snClass}_Set${star}_${place}_Icon_${suit}`;
123
+ }
124
+ }