@typus/typus-sdk 1.0.42 → 1.0.44
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.
|
@@ -18,3 +18,6 @@ export declare const sponsorTransactionBlock: (gaslessTxb: any, sponsor: any, pr
|
|
|
18
18
|
export declare const executeSponsorTransactionBlock: (provider: any, sponsoredResponse: any, senderSig: any) => Promise<void>;
|
|
19
19
|
export declare const sponsorTransactionE2E: (gaslessTxb: any, sponsor: any, provider: any, signer: any, gasBudget: any) => Promise<void>;
|
|
20
20
|
export declare function getSponsoredDeposit(packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string, signerAddress: string): Promise<[SponsoredTransaction, Uint8Array]>;
|
|
21
|
+
export declare function getSponsoredCompound(packageId: string, typeArguments: string[], registry: string, index: string, signerAddress: string): Promise<[SponsoredTransaction, Uint8Array]>;
|
|
22
|
+
export declare function getSponsoredNewBid(packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
|
|
23
|
+
signerAddress: string): Promise<[SponsoredTransaction, Uint8Array]>;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getSponsoredDeposit = exports.sponsorTransactionE2E = exports.executeSponsorTransactionBlock = exports.sponsorTransactionBlock = exports.sponsorRpcClient = void 0;
|
|
39
|
+
exports.getSponsoredNewBid = exports.getSponsoredCompound = exports.getSponsoredDeposit = exports.sponsorTransactionE2E = exports.executeSponsorTransactionBlock = exports.sponsorTransactionBlock = exports.sponsorRpcClient = void 0;
|
|
40
40
|
var typed_rpc_1 = require("typed-rpc");
|
|
41
41
|
var sponsorRpcClient = function (sponserRpcUrl) { return (0, typed_rpc_1.rpcClient)(sponserRpcUrl); };
|
|
42
42
|
exports.sponsorRpcClient = sponsorRpcClient;
|
|
@@ -76,6 +76,7 @@ var executeSponsorTransactionBlock = function (provider, sponsoredResponse, send
|
|
|
76
76
|
})];
|
|
77
77
|
case 1:
|
|
78
78
|
executeResponse = _b.sent();
|
|
79
|
+
console.log(executeResponse, "executeResponse");
|
|
79
80
|
console.log("Execution Status:", (_a = executeResponse.effects) === null || _a === void 0 ? void 0 : _a.status.status);
|
|
80
81
|
return [2 /*return*/];
|
|
81
82
|
}
|
|
@@ -126,6 +127,7 @@ function getSponsoredDeposit(packageId, typeArguments, registry, index, coins, a
|
|
|
126
127
|
switch (_a.label) {
|
|
127
128
|
case 0:
|
|
128
129
|
jsonData = JSON.stringify({
|
|
130
|
+
functionName: "deposit",
|
|
129
131
|
packageId: packageId,
|
|
130
132
|
typeArguments: typeArguments,
|
|
131
133
|
registry: registry,
|
|
@@ -153,3 +155,74 @@ function getSponsoredDeposit(packageId, typeArguments, registry, index, coins, a
|
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
157
|
exports.getSponsoredDeposit = getSponsoredDeposit;
|
|
158
|
+
function getSponsoredCompound(packageId, typeArguments, registry, index, signerAddress) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
160
|
+
var jsonData, response, data, sponsoredResponse, transactionBlock;
|
|
161
|
+
return __generator(this, function (_a) {
|
|
162
|
+
switch (_a.label) {
|
|
163
|
+
case 0:
|
|
164
|
+
jsonData = JSON.stringify({
|
|
165
|
+
functionName: "compound",
|
|
166
|
+
packageId: packageId,
|
|
167
|
+
typeArguments: typeArguments,
|
|
168
|
+
registry: registry,
|
|
169
|
+
index: index,
|
|
170
|
+
signerAddress: signerAddress,
|
|
171
|
+
});
|
|
172
|
+
return [4 /*yield*/, fetch("https://function-1-jbw5emju3a-uc.a.run.app", {
|
|
173
|
+
method: "POST",
|
|
174
|
+
headers: { "Content-Type": "application/json" },
|
|
175
|
+
body: jsonData,
|
|
176
|
+
})];
|
|
177
|
+
case 1:
|
|
178
|
+
response = _a.sent();
|
|
179
|
+
return [4 /*yield*/, response.json()];
|
|
180
|
+
case 2:
|
|
181
|
+
data = _a.sent();
|
|
182
|
+
console.log(data);
|
|
183
|
+
sponsoredResponse = data[0];
|
|
184
|
+
transactionBlock = Buffer.from(data[1].data);
|
|
185
|
+
return [2 /*return*/, [sponsoredResponse, transactionBlock]];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
exports.getSponsoredCompound = getSponsoredCompound;
|
|
191
|
+
function getSponsoredNewBid(packageId, typeArguments, registry, index, priceOracle, coins, size, premium_required, // fe float * b_token_decimal
|
|
192
|
+
signerAddress) {
|
|
193
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
194
|
+
var jsonData, response, data, sponsoredResponse, transactionBlock;
|
|
195
|
+
return __generator(this, function (_a) {
|
|
196
|
+
switch (_a.label) {
|
|
197
|
+
case 0:
|
|
198
|
+
jsonData = JSON.stringify({
|
|
199
|
+
functionName: "newBid",
|
|
200
|
+
packageId: packageId,
|
|
201
|
+
typeArguments: typeArguments,
|
|
202
|
+
registry: registry,
|
|
203
|
+
index: index,
|
|
204
|
+
priceOracle: priceOracle,
|
|
205
|
+
coins: coins,
|
|
206
|
+
size: size,
|
|
207
|
+
premium_required: premium_required,
|
|
208
|
+
signerAddress: signerAddress,
|
|
209
|
+
});
|
|
210
|
+
return [4 /*yield*/, fetch("https://function-1-jbw5emju3a-uc.a.run.app", {
|
|
211
|
+
method: "POST",
|
|
212
|
+
headers: { "Content-Type": "application/json" },
|
|
213
|
+
body: jsonData,
|
|
214
|
+
})];
|
|
215
|
+
case 1:
|
|
216
|
+
response = _a.sent();
|
|
217
|
+
return [4 /*yield*/, response.json()];
|
|
218
|
+
case 2:
|
|
219
|
+
data = _a.sent();
|
|
220
|
+
console.log(data);
|
|
221
|
+
sponsoredResponse = data[0];
|
|
222
|
+
transactionBlock = Buffer.from(data[1].data);
|
|
223
|
+
return [2 /*return*/, [sponsoredResponse, transactionBlock]];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
exports.getSponsoredNewBid = getSponsoredNewBid;
|