@snapshot-labs/snapshot.js 0.12.57 → 0.12.58
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/snapshot.cjs.js +33 -2
- package/dist/snapshot.esm.js +33 -2
- package/dist/snapshot.min.js +1 -1
- package/dist/src/utils.d.ts +1 -0
- package/package.json +1 -1
- package/src/utils.ts +40 -2
package/dist/snapshot.cjs.js
CHANGED
|
@@ -4873,8 +4873,8 @@ function getEnsOwner(ens_1) {
|
|
|
4873
4873
|
return owner || EMPTY_ADDRESS;
|
|
4874
4874
|
});
|
|
4875
4875
|
}
|
|
4876
|
-
function
|
|
4877
|
-
return __awaiter(this, arguments, void 0, function* (id, network
|
|
4876
|
+
function getEnsSpaceController(id_1, network_1) {
|
|
4877
|
+
return __awaiter(this, arguments, void 0, function* (id, network, options = {}) {
|
|
4878
4878
|
const spaceUri = yield getSpaceUri(id, network, options);
|
|
4879
4879
|
if (spaceUri) {
|
|
4880
4880
|
let isUriAddress = address.isAddress(spaceUri);
|
|
@@ -4890,6 +4890,37 @@ function getSpaceController(id_1) {
|
|
|
4890
4890
|
return yield getEnsOwner(id, network, options);
|
|
4891
4891
|
});
|
|
4892
4892
|
}
|
|
4893
|
+
function getShibariumNameOwner(id, network) {
|
|
4894
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4895
|
+
if (!id.endsWith('.shib')) {
|
|
4896
|
+
return EMPTY_ADDRESS;
|
|
4897
|
+
}
|
|
4898
|
+
const response = yield fetch__default['default']('https://stamp.fyi', {
|
|
4899
|
+
method: 'POST',
|
|
4900
|
+
headers: {
|
|
4901
|
+
'Content-Type': 'application/json'
|
|
4902
|
+
},
|
|
4903
|
+
body: JSON.stringify({
|
|
4904
|
+
method: 'get_owner',
|
|
4905
|
+
params: id,
|
|
4906
|
+
network
|
|
4907
|
+
})
|
|
4908
|
+
});
|
|
4909
|
+
const data = yield response.json();
|
|
4910
|
+
return data.result;
|
|
4911
|
+
});
|
|
4912
|
+
}
|
|
4913
|
+
function getSpaceController(id_1) {
|
|
4914
|
+
return __awaiter(this, arguments, void 0, function* (id, network = '1', options = {}) {
|
|
4915
|
+
if (['1', '11155111'].includes(network)) {
|
|
4916
|
+
return getEnsSpaceController(id, network, options);
|
|
4917
|
+
}
|
|
4918
|
+
else if (['109', '157'].includes(network)) {
|
|
4919
|
+
return getShibariumNameOwner(id, network);
|
|
4920
|
+
}
|
|
4921
|
+
throw new Error(`Network not supported: ${network}`);
|
|
4922
|
+
});
|
|
4923
|
+
}
|
|
4893
4924
|
function clone(item) {
|
|
4894
4925
|
return JSON.parse(JSON.stringify(item));
|
|
4895
4926
|
}
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -4863,8 +4863,8 @@ function getEnsOwner(ens_1) {
|
|
|
4863
4863
|
return owner || EMPTY_ADDRESS;
|
|
4864
4864
|
});
|
|
4865
4865
|
}
|
|
4866
|
-
function
|
|
4867
|
-
return __awaiter(this, arguments, void 0, function* (id, network
|
|
4866
|
+
function getEnsSpaceController(id_1, network_1) {
|
|
4867
|
+
return __awaiter(this, arguments, void 0, function* (id, network, options = {}) {
|
|
4868
4868
|
const spaceUri = yield getSpaceUri(id, network, options);
|
|
4869
4869
|
if (spaceUri) {
|
|
4870
4870
|
let isUriAddress = isAddress(spaceUri);
|
|
@@ -4880,6 +4880,37 @@ function getSpaceController(id_1) {
|
|
|
4880
4880
|
return yield getEnsOwner(id, network, options);
|
|
4881
4881
|
});
|
|
4882
4882
|
}
|
|
4883
|
+
function getShibariumNameOwner(id, network) {
|
|
4884
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4885
|
+
if (!id.endsWith('.shib')) {
|
|
4886
|
+
return EMPTY_ADDRESS;
|
|
4887
|
+
}
|
|
4888
|
+
const response = yield fetch('https://stamp.fyi', {
|
|
4889
|
+
method: 'POST',
|
|
4890
|
+
headers: {
|
|
4891
|
+
'Content-Type': 'application/json'
|
|
4892
|
+
},
|
|
4893
|
+
body: JSON.stringify({
|
|
4894
|
+
method: 'get_owner',
|
|
4895
|
+
params: id,
|
|
4896
|
+
network
|
|
4897
|
+
})
|
|
4898
|
+
});
|
|
4899
|
+
const data = yield response.json();
|
|
4900
|
+
return data.result;
|
|
4901
|
+
});
|
|
4902
|
+
}
|
|
4903
|
+
function getSpaceController(id_1) {
|
|
4904
|
+
return __awaiter(this, arguments, void 0, function* (id, network = '1', options = {}) {
|
|
4905
|
+
if (['1', '11155111'].includes(network)) {
|
|
4906
|
+
return getEnsSpaceController(id, network, options);
|
|
4907
|
+
}
|
|
4908
|
+
else if (['109', '157'].includes(network)) {
|
|
4909
|
+
return getShibariumNameOwner(id, network);
|
|
4910
|
+
}
|
|
4911
|
+
throw new Error(`Network not supported: ${network}`);
|
|
4912
|
+
});
|
|
4913
|
+
}
|
|
4883
4914
|
function clone(item) {
|
|
4884
4915
|
return JSON.parse(JSON.stringify(item));
|
|
4885
4916
|
}
|