@credenza3/contracts-lib-sui 0.0.5 → 0.0.6
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.
|
@@ -2110,6 +2110,33 @@ var CredenzaAirdrop = (function (_super) {
|
|
|
2110
2110
|
});
|
|
2111
2111
|
});
|
|
2112
2112
|
};
|
|
2113
|
+
CredenzaAirdrop.prototype.getAirdropAssetType = function (configId) {
|
|
2114
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
2115
|
+
var config, fieldData, _i, _a, item;
|
|
2116
|
+
var _b, _c;
|
|
2117
|
+
return __generator(this, function (_d) {
|
|
2118
|
+
switch (_d.label) {
|
|
2119
|
+
case 0: return [4, this.client.suiClient.getObject({ id: configId, options: { showContent: true } })];
|
|
2120
|
+
case 1:
|
|
2121
|
+
config = _d.sent();
|
|
2122
|
+
if (!parseInt((0, get_1.default)(config, 'data.content.fields.items.fields.size'))) return [3, 3];
|
|
2123
|
+
return [4, this.client.suiClient.getDynamicFields({
|
|
2124
|
+
parentId: (0, get_1.default)(config, 'data.content.fields.items.fields.id.id'),
|
|
2125
|
+
})];
|
|
2126
|
+
case 2:
|
|
2127
|
+
fieldData = _d.sent();
|
|
2128
|
+
for (_i = 0, _a = fieldData.data; _i < _a.length; _i++) {
|
|
2129
|
+
item = _a[_i];
|
|
2130
|
+
if (((_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.type) !== '0x2::object::ID') {
|
|
2131
|
+
return [2, (_c = item.objectType) !== null && _c !== void 0 ? _c : null];
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
_d.label = 3;
|
|
2135
|
+
case 3: return [2, null];
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2138
|
+
});
|
|
2139
|
+
};
|
|
2113
2140
|
CredenzaAirdrop.prototype.requestCoin = function (configId, amount) {
|
|
2114
2141
|
return __awaiter(this, void 0, Promise, function () {
|
|
2115
2142
|
var coinType, tx;
|
|
@@ -2134,13 +2161,13 @@ var CredenzaAirdrop = (function (_super) {
|
|
|
2134
2161
|
};
|
|
2135
2162
|
CredenzaAirdrop.prototype.requestAsset = function (configId, assetId, amount) {
|
|
2136
2163
|
return __awaiter(this, void 0, Promise, function () {
|
|
2137
|
-
var
|
|
2164
|
+
var assetType, tx;
|
|
2138
2165
|
return __generator(this, function (_a) {
|
|
2139
2166
|
switch (_a.label) {
|
|
2140
|
-
case 0: return [4, this.
|
|
2167
|
+
case 0: return [4, this.getAirdropAssetType(configId)];
|
|
2141
2168
|
case 1:
|
|
2142
|
-
|
|
2143
|
-
if (!
|
|
2169
|
+
assetType = _a.sent();
|
|
2170
|
+
if (!assetType) {
|
|
2144
2171
|
throw new Error("This config does not have coin to drop setup");
|
|
2145
2172
|
}
|
|
2146
2173
|
tx = new transactions_1.Transaction();
|
|
@@ -2719,6 +2746,27 @@ var CredenzaAssetCollection = (function (_super) {
|
|
|
2719
2746
|
});
|
|
2720
2747
|
});
|
|
2721
2748
|
};
|
|
2749
|
+
CredenzaAssetCollection.prototype.getOwners = function () {
|
|
2750
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
2751
|
+
var collectionCapId, res, collectionCap, _i, _a, field;
|
|
2752
|
+
return __generator(this, function (_b) {
|
|
2753
|
+
switch (_b.label) {
|
|
2754
|
+
case 0: return [4, this.getCollectionCap()];
|
|
2755
|
+
case 1:
|
|
2756
|
+
collectionCapId = _b.sent();
|
|
2757
|
+
res = [];
|
|
2758
|
+
return [4, this.client.suiClient.getObject({ id: collectionCapId, options: { showContent: true } })];
|
|
2759
|
+
case 2:
|
|
2760
|
+
collectionCap = _b.sent();
|
|
2761
|
+
for (_i = 0, _a = (0, get_1.default)(collectionCap, 'data.content.fields.ownership.fields.owners.fields.contents'); _i < _a.length; _i++) {
|
|
2762
|
+
field = _a[_i];
|
|
2763
|
+
res.push(field);
|
|
2764
|
+
}
|
|
2765
|
+
return [2, res];
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2768
|
+
});
|
|
2769
|
+
};
|
|
2722
2770
|
return CredenzaAssetCollection;
|
|
2723
2771
|
}(CredenzaSuiModule_1.CredenzaSuiModule));
|
|
2724
2772
|
exports.CredenzaAssetCollection = CredenzaAssetCollection;
|