sacredrealm-sdk 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/src/utils.ts +20 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "sacredrealm-sdk",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
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.
|
26
|
+
"sacredrealm-core": "^1.0.2"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
29
|
"tsdx": "^0.14.1"
|
package/src/utils.ts
CHANGED
@@ -101,3 +101,23 @@ export function getSigner() {
|
|
101
101
|
export function getRandomNumber(snId: number, slot: string, base: number, range: number) {
|
102
102
|
return BigNumber.from(utils.solidityKeccak256(['uint256', 'string'], [snId, slot])).mod(range).add(base).toNumber();
|
103
103
|
}
|
104
|
+
|
105
|
+
export function getSourceUrl(attr: number[]) {
|
106
|
+
const cdn = '//cdn.sealemlab.io/nft';
|
107
|
+
|
108
|
+
const starArr = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11'];
|
109
|
+
const snClassArr = ['Gl', 'As', 'Wi', 'Fi'];
|
110
|
+
const placeArr = ['Wp', 'Hair', 'Upper', 'Arm', 'Leg', 'Belt', 'Neck', 'Ring'];
|
111
|
+
const suitArr = ['01', '02', '03', '04'];
|
112
|
+
|
113
|
+
const star = starArr[attr[0] - 1];
|
114
|
+
const snClass = snClassArr[attr[2] - 1];
|
115
|
+
const place = placeArr[attr[3] - 1];
|
116
|
+
const suit = suitArr[attr[4] - 1];
|
117
|
+
|
118
|
+
if (attr[3] >= 6) {
|
119
|
+
return `${cdn}/${snClass}/TEX_ACC_${snClass}_A_${place}_${suit}`;
|
120
|
+
} else {
|
121
|
+
return `${cdn}/${snClass}/TEX_PC_${snClass}_Set${star}_${place}_Icon_${suit}`;
|
122
|
+
}
|
123
|
+
}
|