@typus/typus-sdk 1.0.41 → 1.0.42

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.
@@ -17,3 +17,4 @@ export interface SponsorRpc {
17
17
  export declare const sponsorTransactionBlock: (gaslessTxb: any, sponsor: any, provider: any, gasBudget: any, signerAddress: any) => Promise<[SponsoredTransaction, Uint8Array]>;
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
+ export declare function getSponsoredDeposit(packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string, 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.sponsorTransactionE2E = exports.executeSponsorTransactionBlock = exports.sponsorTransactionBlock = exports.sponsorRpcClient = void 0;
39
+ 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;
@@ -119,3 +119,37 @@ var sponsorTransactionE2E = function (gaslessTxb, sponsor, provider, signer, gas
119
119
  });
120
120
  }); };
121
121
  exports.sponsorTransactionE2E = sponsorTransactionE2E;
122
+ function getSponsoredDeposit(packageId, typeArguments, registry, index, coins, amount, signerAddress) {
123
+ return __awaiter(this, void 0, void 0, function () {
124
+ var jsonData, response, data, sponsoredResponse, transactionBlock;
125
+ return __generator(this, function (_a) {
126
+ switch (_a.label) {
127
+ case 0:
128
+ jsonData = JSON.stringify({
129
+ packageId: packageId,
130
+ typeArguments: typeArguments,
131
+ registry: registry,
132
+ index: index,
133
+ coins: coins,
134
+ amount: amount,
135
+ signerAddress: signerAddress,
136
+ });
137
+ return [4 /*yield*/, fetch("https://function-1-jbw5emju3a-uc.a.run.app", {
138
+ method: "POST",
139
+ headers: { "Content-Type": "application/json" },
140
+ body: jsonData,
141
+ })];
142
+ case 1:
143
+ response = _a.sent();
144
+ return [4 /*yield*/, response.json()];
145
+ case 2:
146
+ data = _a.sent();
147
+ console.log(data);
148
+ sponsoredResponse = data[0];
149
+ transactionBlock = Buffer.from(data[1].data);
150
+ return [2 /*return*/, [sponsoredResponse, transactionBlock]];
151
+ }
152
+ });
153
+ });
154
+ }
155
+ exports.getSponsoredDeposit = getSponsoredDeposit;
@@ -0,0 +1,4 @@
1
+ export declare function getDb(functionName: string, vaultIndex?: string | undefined): Promise<void>;
2
+ export declare function getNewAuction(vaultIndex?: string | undefined): Promise<void>;
3
+ export declare function getDelivery(vaultIndex?: string | undefined): Promise<void>;
4
+ export declare function getSettle(vaultIndex?: string | undefined): Promise<void>;
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getSettle = exports.getDelivery = exports.getNewAuction = exports.getDb = void 0;
40
+ var dbFilter = function (functionName, vaultIndex) {
41
+ if (vaultIndex === void 0) { vaultIndex = undefined; }
42
+ return ({
43
+ collection: "typus_dov_single",
44
+ database: "mainnet_1_0_0",
45
+ dataSource: "typus",
46
+ filter: {
47
+ function: functionName,
48
+ index: vaultIndex,
49
+ },
50
+ });
51
+ };
52
+ var apiUrl = "https://data.mongodb-api.com/app/data-dwhde/endpoint/data/v1/action/find";
53
+ var headers = {
54
+ "api-key": "ZnJu3wGqGoYotyvHl5Qis0UvUJRDJkBBwIsRaHdmBuzfy4jyPBH1LzazIfOO0GSm",
55
+ "Content-Type": "application/json",
56
+ };
57
+ function getDb(functionName, vaultIndex) {
58
+ if (vaultIndex === void 0) { vaultIndex = undefined; }
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ var jsonData, response, data;
61
+ return __generator(this, function (_a) {
62
+ switch (_a.label) {
63
+ case 0:
64
+ jsonData = JSON.stringify(dbFilter(functionName));
65
+ return [4 /*yield*/, fetch(apiUrl, {
66
+ method: "POST",
67
+ headers: headers,
68
+ body: jsonData,
69
+ })];
70
+ case 1:
71
+ response = _a.sent();
72
+ if (!response.ok) return [3 /*break*/, 3];
73
+ return [4 /*yield*/, response.json()];
74
+ case 2:
75
+ data = _a.sent();
76
+ data.documents.map(function (document) {
77
+ console.log(document);
78
+ });
79
+ _a.label = 3;
80
+ case 3: return [2 /*return*/];
81
+ }
82
+ });
83
+ });
84
+ }
85
+ exports.getDb = getDb;
86
+ function getNewAuction(vaultIndex) {
87
+ if (vaultIndex === void 0) { vaultIndex = undefined; }
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ return __generator(this, function (_a) {
90
+ switch (_a.label) {
91
+ case 0: return [4 /*yield*/, getDb("NewAuction", vaultIndex)];
92
+ case 1:
93
+ _a.sent();
94
+ return [2 /*return*/];
95
+ }
96
+ });
97
+ });
98
+ }
99
+ exports.getNewAuction = getNewAuction;
100
+ function getDelivery(vaultIndex) {
101
+ if (vaultIndex === void 0) { vaultIndex = undefined; }
102
+ return __awaiter(this, void 0, void 0, function () {
103
+ return __generator(this, function (_a) {
104
+ switch (_a.label) {
105
+ case 0: return [4 /*yield*/, getDb("Delivery", vaultIndex)];
106
+ case 1:
107
+ _a.sent();
108
+ return [2 /*return*/];
109
+ }
110
+ });
111
+ });
112
+ }
113
+ exports.getDelivery = getDelivery;
114
+ function getSettle(vaultIndex) {
115
+ if (vaultIndex === void 0) { vaultIndex = undefined; }
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ return __generator(this, function (_a) {
118
+ switch (_a.label) {
119
+ case 0: return [4 /*yield*/, getDb("Settle", vaultIndex)];
120
+ case 1:
121
+ _a.sent();
122
+ return [2 /*return*/];
123
+ }
124
+ });
125
+ });
126
+ }
127
+ exports.getSettle = getSettle;
128
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
129
+ return __generator(this, function (_a) {
130
+ switch (_a.label) {
131
+ case 0: return [4 /*yield*/, getSettle()];
132
+ case 1:
133
+ _a.sent();
134
+ return [2 /*return*/];
135
+ }
136
+ });
137
+ }); })();
package/package.json CHANGED
@@ -1,84 +1,84 @@
1
1
  {
2
- "name": "@typus/typus-sdk",
3
- "author": "Typus",
4
- "description": "typus sdk",
5
- "version": "1.0.41",
6
- "dependencies": {
7
- "@mysten/sui.js": "0.34.0",
8
- "@types/node": "^17.0.0",
9
- "bignumber.js": "^9.1.1",
10
- "bs58": "^4.0.1",
11
- "builtin-modules": "^1.1.1",
12
- "chai": "^4.3.7",
13
- "decimal.js": "^10.3.1",
14
- "diff": "^4.0.2",
15
- "dotenv": "^10.0.0",
16
- "encrypt-with-password": "^1.0.0",
17
- "escape-string-regexp": "^1.0.5",
18
- "esprima": "^4.0.1",
19
- "fetch": "^1.1.0",
20
- "fs.realpath": "^1.0.0",
21
- "function-bind": "^1.1.1",
22
- "glob": "^7.2.0",
23
- "has": "^1.0.3",
24
- "has-flag": "^3.0.0",
25
- "inflight": "^1.0.6",
26
- "inherits": "^2.0.4",
27
- "is-core-module": "^2.8.0",
28
- "js-sha3": "^0.8.0",
29
- "js-tokens": "^4.0.0",
30
- "js-yaml": "^3.14.1",
31
- "math-erf": "^1.0.0",
32
- "minimatch": "^3.0.4",
33
- "minimist": "^1.2.5",
34
- "mkdirp": "^0.5.5",
35
- "mocha": "^10.1.0",
36
- "moment": "^2.29.4",
37
- "node-cron": "^3.0.2",
38
- "once": "^1.4.0",
39
- "path-is-absolute": "^1.0.1",
40
- "path-parse": "^1.0.7",
41
- "random-bigint": "^0.0.1",
42
- "resolve": "^1.20.0",
43
- "rxjs": "^7.5.5",
44
- "semver": "^5.7.1",
45
- "sprintf-js": "^1.0.3",
46
- "superstruct": "^0.16.0",
47
- "supports-color": "^5.5.0",
48
- "ts-mocha": "^10.0.0",
49
- "tslib": "^1.14.1",
50
- "tsutils": "^2.29.0",
51
- "typed-rpc": "^3.0.0",
52
- "wrappy": "^1.0.2",
53
- "ws": "^8.11.0",
54
- "xmlhttprequest": "^1.8.0"
55
- },
56
- "devDependencies": {
57
- "@types/bs58": "^4.0.1",
58
- "@types/expect": "^24.3.0",
59
- "@types/mocha": "^9.0.0",
60
- "@types/rx": "^4.1.2",
61
- "prettier": "^2.5.1",
62
- "tslint": "^6.1.3",
63
- "tslint-config-prettier": "^1.18.0",
64
- "typescript": "^4.5.4"
65
- },
66
- "main": "lib/index.js",
67
- "files": [
68
- "lib"
69
- ],
70
- "types": "lib/index.d.ts",
71
- "scripts": {
72
- "test": "rm -rf lib && tsc && ts-mocha test/test*.ts",
73
- "build": "rm -rf lib && tsc"
74
- },
75
- "repository": {
76
- "type": "git",
77
- "url": "git+https://github.com/Typus-Lab/typus-sdk.git"
78
- },
79
- "license": "ISC",
80
- "bugs": {
81
- "url": "https://github.com/Typus-Lab/typus-sdk/issues"
82
- },
83
- "homepage": "https://github.com/Typus-Lab/typus-sdk#readme"
2
+ "name": "@typus/typus-sdk",
3
+ "author": "Typus",
4
+ "description": "typus sdk",
5
+ "version": "1.0.42",
6
+ "dependencies": {
7
+ "@mysten/sui.js": "^0.34.0",
8
+ "@types/node": "^17.0.0",
9
+ "bignumber.js": "^9.1.1",
10
+ "bs58": "^4.0.1",
11
+ "builtin-modules": "^1.1.1",
12
+ "chai": "^4.3.7",
13
+ "decimal.js": "^10.3.1",
14
+ "diff": "^4.0.2",
15
+ "dotenv": "^10.0.0",
16
+ "encrypt-with-password": "^1.0.0",
17
+ "escape-string-regexp": "^1.0.5",
18
+ "esprima": "^4.0.1",
19
+ "fetch": "^1.1.0",
20
+ "fs.realpath": "^1.0.0",
21
+ "function-bind": "^1.1.1",
22
+ "glob": "^7.2.0",
23
+ "has": "^1.0.3",
24
+ "has-flag": "^3.0.0",
25
+ "inflight": "^1.0.6",
26
+ "inherits": "^2.0.4",
27
+ "is-core-module": "^2.8.0",
28
+ "js-sha3": "^0.8.0",
29
+ "js-tokens": "^4.0.0",
30
+ "js-yaml": "^3.14.1",
31
+ "math-erf": "^1.0.0",
32
+ "minimatch": "^3.0.4",
33
+ "minimist": "^1.2.5",
34
+ "mkdirp": "^0.5.5",
35
+ "mocha": "^10.1.0",
36
+ "moment": "^2.29.4",
37
+ "node-cron": "^3.0.2",
38
+ "once": "^1.4.0",
39
+ "path-is-absolute": "^1.0.1",
40
+ "path-parse": "^1.0.7",
41
+ "random-bigint": "^0.0.1",
42
+ "resolve": "^1.20.0",
43
+ "rxjs": "^7.5.5",
44
+ "semver": "^5.7.1",
45
+ "sprintf-js": "^1.0.3",
46
+ "superstruct": "^0.16.0",
47
+ "supports-color": "^5.5.0",
48
+ "ts-mocha": "^10.0.0",
49
+ "tslib": "^1.14.1",
50
+ "tsutils": "^2.29.0",
51
+ "typed-rpc": "^3.0.0",
52
+ "wrappy": "^1.0.2",
53
+ "ws": "^8.11.0",
54
+ "xmlhttprequest": "^1.8.0"
55
+ },
56
+ "devDependencies": {
57
+ "@types/bs58": "^4.0.1",
58
+ "@types/expect": "^24.3.0",
59
+ "@types/mocha": "^9.0.0",
60
+ "@types/rx": "^4.1.2",
61
+ "prettier": "^2.5.1",
62
+ "tslint": "^6.1.3",
63
+ "tslint-config-prettier": "^1.18.0",
64
+ "typescript": "^4.5.4"
65
+ },
66
+ "main": "lib/index.js",
67
+ "files": [
68
+ "lib"
69
+ ],
70
+ "types": "lib/index.d.ts",
71
+ "scripts": {
72
+ "test": "rm -rf lib && tsc && ts-mocha test/test*.ts",
73
+ "build": "rm -rf lib && tsc"
74
+ },
75
+ "repository": {
76
+ "type": "git",
77
+ "url": "git+https://github.com/Typus-Lab/typus-sdk.git"
78
+ },
79
+ "license": "ISC",
80
+ "bugs": {
81
+ "url": "https://github.com/Typus-Lab/typus-sdk/issues"
82
+ },
83
+ "homepage": "https://github.com/Typus-Lab/typus-sdk#readme"
84
84
  }