@clonegod/ttd-sol-common 1.2.1 → 2.0.1
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/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/quote/index.d.ts +1 -3
- package/dist/quote/index.js +1 -3
- package/dist/quote/pricing/index.d.ts +1 -0
- package/dist/{helius_sdk_v1.4.0/utils → quote/pricing}/index.js +1 -1
- package/dist/quote/pricing/token_price_cache.d.ts +9 -0
- package/dist/quote/pricing/token_price_cache.js +39 -0
- package/package.json +2 -3
- package/src/index.ts +1 -0
- package/src/quote/index.ts +1 -0
- package/src/quote/pricing/index.ts +1 -0
- package/src/quote/pricing/token_price_cache.ts +48 -0
- package/tsconfig.json +22 -0
- package/dist/appconfig/app_config.d.ts +0 -23
- package/dist/appconfig/app_config.js +0 -134
- package/dist/appconfig/env_args.d.ts +0 -27
- package/dist/appconfig/env_args.js +0 -39
- package/dist/appconfig/index.d.ts +0 -2
- package/dist/appconfig/index.js +0 -18
- package/dist/common/constants.d.ts +0 -12
- package/dist/common/constants.js +0 -18
- package/dist/common/context.d.ts +0 -23
- package/dist/common/context.js +0 -51
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.js +0 -18
- package/dist/helius_geyser_ws/index.d.ts +0 -3
- package/dist/helius_geyser_ws/index.js +0 -19
- package/dist/helius_geyser_ws/subscribe_pool_change_by_geyser.d.ts +0 -3
- package/dist/helius_geyser_ws/subscribe_pool_change_by_geyser.js +0 -102
- package/dist/helius_geyser_ws/subscribe_txid.d.ts +0 -2
- package/dist/helius_geyser_ws/subscribe_txid.js +0 -109
- package/dist/helius_geyser_ws/subscribe_wallet_transaction.d.ts +0 -2
- package/dist/helius_geyser_ws/subscribe_wallet_transaction.js +0 -102
- package/dist/helius_sdk_v1.4.0/Helius.d.ts +0 -31
- package/dist/helius_sdk_v1.4.0/Helius.js +0 -450
- package/dist/helius_sdk_v1.4.0/RpcClient.d.ts +0 -70
- package/dist/helius_sdk_v1.4.0/RpcClient.js +0 -978
- package/dist/helius_sdk_v1.4.0/constants.d.ts +0 -1
- package/dist/helius_sdk_v1.4.0/constants.js +0 -4
- package/dist/helius_sdk_v1.4.0/index.d.ts +0 -5
- package/dist/helius_sdk_v1.4.0/index.js +0 -21
- package/dist/helius_sdk_v1.4.0/types/das-types.d.ts +0 -408
- package/dist/helius_sdk_v1.4.0/types/das-types.js +0 -2
- package/dist/helius_sdk_v1.4.0/types/enums.d.ts +0 -542
- package/dist/helius_sdk_v1.4.0/types/enums.js +0 -606
- package/dist/helius_sdk_v1.4.0/types/index.d.ts +0 -3
- package/dist/helius_sdk_v1.4.0/types/index.js +0 -19
- package/dist/helius_sdk_v1.4.0/types/types.d.ts +0 -305
- package/dist/helius_sdk_v1.4.0/types/types.js +0 -2
- package/dist/helius_sdk_v1.4.0/utils/get-helius-endpoints.d.ts +0 -2
- package/dist/helius_sdk_v1.4.0/utils/get-helius-endpoints.js +0 -19
- package/dist/helius_sdk_v1.4.0/utils/index.d.ts +0 -1
- package/dist/helius_sdk_v1.4.0/utils/mintApi.d.ts +0 -2
- package/dist/helius_sdk_v1.4.0/utils/mintApi.js +0 -14
- package/dist/jito/index.d.ts +0 -14
- package/dist/jito/index.js +0 -142
- package/dist/jito/jitodontfront.d.ts +0 -5
- package/dist/jito/jitodontfront.js +0 -41
- package/dist/quote/log_quote_price.d.ts +0 -2
- package/dist/quote/log_quote_price.js +0 -29
- package/dist/quote/publish_quote_price.d.ts +0 -3
- package/dist/quote/publish_quote_price.js +0 -19
- package/dist/quote/to_price_message.d.ts +0 -5
- package/dist/quote/to_price_message.js +0 -103
- package/dist/send_tx/get_jito_tip_floor.d.ts +0 -1
- package/dist/send_tx/get_jito_tip_floor.js +0 -86
- package/dist/send_tx/get_signature.d.ts +0 -2
- package/dist/send_tx/get_signature.js +0 -17
- package/dist/send_tx/helius_client.d.ts +0 -16
- package/dist/send_tx/helius_client.js +0 -119
- package/dist/send_tx/index.d.ts +0 -4
- package/dist/send_tx/index.js +0 -20
- package/dist/send_tx/notify_new_txid.d.ts +0 -1
- package/dist/send_tx/notify_new_txid.js +0 -20
- package/dist/send_tx/sol_gas_cache.d.ts +0 -3
- package/dist/send_tx/sol_gas_cache.js +0 -15
- package/dist/send_tx/strategy_util.d.ts +0 -7
- package/dist/send_tx/strategy_util.js +0 -147
- package/dist/token/get_token_info.d.ts +0 -4
- package/dist/token/get_token_info.js +0 -136
- package/dist/token/get_token_price.d.ts +0 -6
- package/dist/token/get_token_price.js +0 -186
- package/dist/token/index.d.ts +0 -4
- package/dist/token/index.js +0 -20
- package/dist/token/types.d.ts +0 -17
- package/dist/token/types.js +0 -2
- package/dist/token/util.d.ts +0 -3
- package/dist/token/util.js +0 -33
- package/dist/trade/abstract_trade.d.ts +0 -5
- package/dist/trade/abstract_trade.js +0 -6
- package/dist/trade/handle_order_message.d.ts +0 -4
- package/dist/trade/handle_order_message.js +0 -118
- package/dist/trade/index.d.ts +0 -4
- package/dist/trade/index.js +0 -20
- package/dist/trade/tx_result_check.d.ts +0 -29
- package/dist/trade/tx_result_check.js +0 -232
- package/dist/trade/tx_result_parse.d.ts +0 -13
- package/dist/trade/tx_result_parse.js +0 -150
- package/grpc/transaction/LThcUp2D5p4JgRMnWEUVVSdNEHiq5YfN5HXPGRYeWBfypMT3aTa1CaC9XdPT69CyMdoJ32XAkjXAa2TmBYBeZAy.json +0 -1
- package/types/index.d.ts +0 -71
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.Helius = void 0;
|
|
49
|
-
const axios_1 = __importDefault(require("axios"));
|
|
50
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
51
|
-
const fs = __importStar(require("fs"));
|
|
52
|
-
const utils_1 = require("./utils");
|
|
53
|
-
const RpcClient_1 = require("./RpcClient");
|
|
54
|
-
const mpl_token_metadata_1 = require("@metaplex-foundation/mpl-token-metadata");
|
|
55
|
-
const mintApi_1 = require("./utils/mintApi");
|
|
56
|
-
class Helius {
|
|
57
|
-
constructor(apiKey, cluster = 'mainnet-beta', id = 'helius-sdk', url = '') {
|
|
58
|
-
this.cluster = cluster;
|
|
59
|
-
this.endpoints = (0, utils_1.getHeliusEndpoints)(cluster);
|
|
60
|
-
if (apiKey !== '') {
|
|
61
|
-
this.apiKey = apiKey;
|
|
62
|
-
this.connection = new web3_js_1.Connection(`${this.endpoints.rpc}?api-key=${apiKey}`);
|
|
63
|
-
}
|
|
64
|
-
else if (url !== '') {
|
|
65
|
-
this.connection = new web3_js_1.Connection(url);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
throw Error('either `apiKey` or `url` is required');
|
|
69
|
-
}
|
|
70
|
-
this.endpoint = this.connection.rpcEndpoint;
|
|
71
|
-
this.rpc = new RpcClient_1.RpcClient(this.connection, id);
|
|
72
|
-
this.mintApiAuthority = (0, mintApi_1.mintApiAuthority)(cluster);
|
|
73
|
-
}
|
|
74
|
-
getAllWebhooks() {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
var _a;
|
|
77
|
-
try {
|
|
78
|
-
const { data } = yield axios_1.default.get(this.getApiEndpoint(`/v0/webhooks`));
|
|
79
|
-
return data;
|
|
80
|
-
}
|
|
81
|
-
catch (err) {
|
|
82
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
83
|
-
throw new Error(`error calling getWebhooks: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
throw new Error(`error calling getWebhooks: ${err}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
getWebhookByID(webhookID) {
|
|
92
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
var _a;
|
|
94
|
-
try {
|
|
95
|
-
const { data } = yield axios_1.default.get(this.getApiEndpoint(`/v0/webhooks/${webhookID}`));
|
|
96
|
-
return data;
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
100
|
-
throw new Error(`error during getWebhookByID: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
throw new Error(`error during getWebhookByID: ${err}`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
createWebhook(createWebhookRequest) {
|
|
109
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
var _a;
|
|
111
|
-
try {
|
|
112
|
-
const { data } = yield axios_1.default.post(this.getApiEndpoint(`/v0/webhooks`), Object.assign({}, createWebhookRequest));
|
|
113
|
-
return data;
|
|
114
|
-
}
|
|
115
|
-
catch (err) {
|
|
116
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
117
|
-
throw new Error(`error during createWebhook: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
throw new Error(`error during createWebhook: ${err}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
deleteWebhook(webhookID) {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
var _a;
|
|
128
|
-
try {
|
|
129
|
-
yield axios_1.default.delete(this.getApiEndpoint(`/v0/webhooks/${webhookID}`));
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
catch (err) {
|
|
133
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
134
|
-
throw new Error(`error during deleteWebhook: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
throw new Error(`error during deleteWebhook: ${err}`);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
editWebhook(webhookID, editWebhookRequest) {
|
|
143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
var _a;
|
|
145
|
-
try {
|
|
146
|
-
const existing = yield this.getWebhookByID(webhookID);
|
|
147
|
-
return this._editWebhook(webhookID, existing, editWebhookRequest);
|
|
148
|
-
}
|
|
149
|
-
catch (err) {
|
|
150
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
151
|
-
throw new Error(`error during editWebhook: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
throw new Error(`error during editWebhook: ${err}`);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
appendAddressesToWebhook(webhookID, newAccountAddresses) {
|
|
160
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
var _a;
|
|
162
|
-
try {
|
|
163
|
-
const webhook = yield this.getWebhookByID(webhookID);
|
|
164
|
-
const accountAddresses = webhook.accountAddresses.concat(newAccountAddresses);
|
|
165
|
-
if (accountAddresses.length > 100000) {
|
|
166
|
-
throw new Error(`a single webhook cannot contain more than 100,000 addresses`);
|
|
167
|
-
}
|
|
168
|
-
const editRequest = { accountAddresses };
|
|
169
|
-
return this._editWebhook(webhookID, webhook, editRequest);
|
|
170
|
-
}
|
|
171
|
-
catch (err) {
|
|
172
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
173
|
-
throw new Error(`error during appendAddressesToWebhook: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
throw new Error(`error during appendAddressesToWebhook: ${err}`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
removeAddressesFromWebhook(webhookID, addressesToRemove) {
|
|
182
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
var _a;
|
|
184
|
-
try {
|
|
185
|
-
const webhook = yield this.getWebhookByID(webhookID);
|
|
186
|
-
const accountAddresses = webhook.accountAddresses.filter((address) => !addressesToRemove.includes(address));
|
|
187
|
-
const editRequest = { accountAddresses };
|
|
188
|
-
return this._editWebhook(webhookID, webhook, editRequest);
|
|
189
|
-
}
|
|
190
|
-
catch (err) {
|
|
191
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
192
|
-
throw new Error(`error during removeAddressesFromWebhook: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
throw new Error(`error during removeAddressesFromWebhook: ${err}`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
createCollectionWebhook(request) {
|
|
201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
var _a;
|
|
203
|
-
if ((request === null || request === void 0 ? void 0 : request.collectionQuery) == undefined) {
|
|
204
|
-
throw new Error(`must provide collectionQuery object.`);
|
|
205
|
-
}
|
|
206
|
-
const { firstVerifiedCreators, verifiedCollectionAddresses } = request.collectionQuery;
|
|
207
|
-
if (firstVerifiedCreators != undefined &&
|
|
208
|
-
verifiedCollectionAddresses != undefined) {
|
|
209
|
-
throw new Error(`cannot provide both firstVerifiedCreators and verifiedCollectionAddresses. Please only provide one.`);
|
|
210
|
-
}
|
|
211
|
-
let mintlist = [];
|
|
212
|
-
let query = {};
|
|
213
|
-
if (firstVerifiedCreators != undefined) {
|
|
214
|
-
query = { firstVerifiedCreators };
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
query = { verifiedCollectionAddresses };
|
|
218
|
-
}
|
|
219
|
-
try {
|
|
220
|
-
let mints = yield this.getMintlist({
|
|
221
|
-
query,
|
|
222
|
-
options: {
|
|
223
|
-
limit: 10000,
|
|
224
|
-
},
|
|
225
|
-
});
|
|
226
|
-
mintlist.push(...mints.result);
|
|
227
|
-
while (mints.paginationToken) {
|
|
228
|
-
mints = yield this.getMintlist({
|
|
229
|
-
query,
|
|
230
|
-
options: {
|
|
231
|
-
limit: 10000,
|
|
232
|
-
paginationToken: mints.paginationToken,
|
|
233
|
-
},
|
|
234
|
-
});
|
|
235
|
-
mintlist.push(...mints.result);
|
|
236
|
-
}
|
|
237
|
-
const { webhookURL, transactionTypes, authHeader, webhookType } = request;
|
|
238
|
-
const payload = {
|
|
239
|
-
webhookURL,
|
|
240
|
-
accountAddresses: mintlist.map((x) => x.mint),
|
|
241
|
-
transactionTypes,
|
|
242
|
-
};
|
|
243
|
-
if (authHeader) {
|
|
244
|
-
payload['authHeader'] = authHeader;
|
|
245
|
-
}
|
|
246
|
-
if (webhookType) {
|
|
247
|
-
payload['webhookType'] = webhookType;
|
|
248
|
-
}
|
|
249
|
-
return yield this.createWebhook(Object.assign({}, payload));
|
|
250
|
-
}
|
|
251
|
-
catch (err) {
|
|
252
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
253
|
-
throw new Error(`error during createCollectionWebhook: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
throw new Error(`error during createCollectionWebhook: ${err}`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
getMintlist(request) {
|
|
262
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
263
|
-
var _a;
|
|
264
|
-
if ((request === null || request === void 0 ? void 0 : request.query) == undefined) {
|
|
265
|
-
throw new Error(`must provide query object.`);
|
|
266
|
-
}
|
|
267
|
-
const { firstVerifiedCreators, verifiedCollectionAddresses } = request.query;
|
|
268
|
-
if (firstVerifiedCreators != undefined &&
|
|
269
|
-
verifiedCollectionAddresses != undefined) {
|
|
270
|
-
throw new Error(`cannot provide both firstVerifiedCreators and verifiedCollectionAddresses. Please only provide one.`);
|
|
271
|
-
}
|
|
272
|
-
try {
|
|
273
|
-
const { data } = yield axios_1.default.post(this.getApiEndpoint(`/v1/mintlist`), Object.assign({}, request));
|
|
274
|
-
return data;
|
|
275
|
-
}
|
|
276
|
-
catch (err) {
|
|
277
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
278
|
-
throw new Error(`error during getMintlist: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) || err}`);
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
throw new Error(`error during getMintlist: ${err}`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
mintCompressedNft(mintApiRequest) {
|
|
287
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
288
|
-
var _a;
|
|
289
|
-
yield this.handleImageUpload(mintApiRequest);
|
|
290
|
-
try {
|
|
291
|
-
const { data } = yield axios_1.default.post(this.endpoint, {
|
|
292
|
-
jsonrpc: '2.0',
|
|
293
|
-
id: 'helius-test',
|
|
294
|
-
method: 'mintCompressedNft',
|
|
295
|
-
params: Object.assign({}, mintApiRequest),
|
|
296
|
-
});
|
|
297
|
-
return data;
|
|
298
|
-
}
|
|
299
|
-
catch (err) {
|
|
300
|
-
if (axios_1.default.isAxiosError(err)) {
|
|
301
|
-
throw new Error(`error during mintCompressedNft: ${((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error.message) || err}`);
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
throw new Error(`error during mintCompressedNft: ${err}`);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
delegateCollectionAuthority(request) {
|
|
310
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
311
|
-
try {
|
|
312
|
-
let { collectionMint, updateAuthorityKeypair, newCollectionAuthority, payerKeypair, } = request;
|
|
313
|
-
payerKeypair = payerKeypair !== null && payerKeypair !== void 0 ? payerKeypair : updateAuthorityKeypair;
|
|
314
|
-
newCollectionAuthority = newCollectionAuthority !== null && newCollectionAuthority !== void 0 ? newCollectionAuthority : this.mintApiAuthority;
|
|
315
|
-
const collectionMintPubkey = new web3_js_1.PublicKey(collectionMint);
|
|
316
|
-
const collectionMetadata = this.getCollectionMetadataAccount(collectionMintPubkey);
|
|
317
|
-
const newCollectionAuthorityPubkey = new web3_js_1.PublicKey(newCollectionAuthority);
|
|
318
|
-
const collectionAuthorityRecord = this.getCollectionAuthorityRecord(collectionMintPubkey, newCollectionAuthorityPubkey);
|
|
319
|
-
const accounts = {
|
|
320
|
-
collectionAuthorityRecord,
|
|
321
|
-
newCollectionAuthority: newCollectionAuthorityPubkey,
|
|
322
|
-
updateAuthority: updateAuthorityKeypair.publicKey,
|
|
323
|
-
payer: payerKeypair.publicKey,
|
|
324
|
-
metadata: collectionMetadata,
|
|
325
|
-
mint: collectionMintPubkey,
|
|
326
|
-
};
|
|
327
|
-
const inx = (0, mpl_token_metadata_1.createApproveCollectionAuthorityInstruction)(accounts);
|
|
328
|
-
const tx = new web3_js_1.Transaction().add(inx);
|
|
329
|
-
tx.feePayer = payerKeypair.publicKey;
|
|
330
|
-
const sig = yield (0, web3_js_1.sendAndConfirmTransaction)(this.connection, tx, [payerKeypair, updateAuthorityKeypair], {
|
|
331
|
-
commitment: 'confirmed',
|
|
332
|
-
skipPreflight: true,
|
|
333
|
-
});
|
|
334
|
-
return sig;
|
|
335
|
-
}
|
|
336
|
-
catch (e) {
|
|
337
|
-
console.error('Failed to delegate collection authority: ', e);
|
|
338
|
-
throw e;
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
revokeCollectionAuthority(request) {
|
|
343
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
344
|
-
try {
|
|
345
|
-
let { collectionMint, revokeAuthorityKeypair, delegatedCollectionAuthority, payerKeypair, } = request;
|
|
346
|
-
payerKeypair = payerKeypair !== null && payerKeypair !== void 0 ? payerKeypair : revokeAuthorityKeypair;
|
|
347
|
-
delegatedCollectionAuthority =
|
|
348
|
-
delegatedCollectionAuthority !== null && delegatedCollectionAuthority !== void 0 ? delegatedCollectionAuthority : this.mintApiAuthority;
|
|
349
|
-
const collectionMintPubkey = new web3_js_1.PublicKey(collectionMint);
|
|
350
|
-
const collectionAuthority = new web3_js_1.PublicKey(delegatedCollectionAuthority);
|
|
351
|
-
const collectionMetadata = this.getCollectionMetadataAccount(collectionMintPubkey);
|
|
352
|
-
const collectionAuthorityRecord = this.getCollectionAuthorityRecord(collectionMintPubkey, collectionAuthority);
|
|
353
|
-
const accounts = {
|
|
354
|
-
collectionAuthorityRecord,
|
|
355
|
-
delegateAuthority: collectionAuthority,
|
|
356
|
-
revokeAuthority: revokeAuthorityKeypair.publicKey,
|
|
357
|
-
metadata: collectionMetadata,
|
|
358
|
-
mint: collectionMintPubkey,
|
|
359
|
-
};
|
|
360
|
-
const inx = (0, mpl_token_metadata_1.createRevokeCollectionAuthorityInstruction)(accounts);
|
|
361
|
-
const tx = new web3_js_1.Transaction().add(inx);
|
|
362
|
-
tx.feePayer = payerKeypair.publicKey;
|
|
363
|
-
const sig = yield (0, web3_js_1.sendAndConfirmTransaction)(this.connection, tx, [revokeAuthorityKeypair], {
|
|
364
|
-
commitment: 'confirmed',
|
|
365
|
-
skipPreflight: true,
|
|
366
|
-
});
|
|
367
|
-
return sig;
|
|
368
|
-
}
|
|
369
|
-
catch (e) {
|
|
370
|
-
console.error('Failed to revoke collection authority: ', e);
|
|
371
|
-
throw e;
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
getApiEndpoint(path) {
|
|
376
|
-
if (!path.startsWith('/v0') && !path.startsWith('/v1')) {
|
|
377
|
-
throw new Error(`Invalid API path provided: ${path}. Path must start with '/v0' or '/v1'.`);
|
|
378
|
-
}
|
|
379
|
-
if (!this.apiKey) {
|
|
380
|
-
throw new Error(`API key is not set`);
|
|
381
|
-
}
|
|
382
|
-
return `${this.endpoints.api}${path}?api-key=${this.apiKey}`;
|
|
383
|
-
}
|
|
384
|
-
_editWebhook(webhookID, existingWebhook, editWebhookRequest) {
|
|
385
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
386
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
387
|
-
const editRequest = {
|
|
388
|
-
webhookURL: (_a = editWebhookRequest.webhookURL) !== null && _a !== void 0 ? _a : existingWebhook.webhookURL,
|
|
389
|
-
transactionTypes: (_b = editWebhookRequest.transactionTypes) !== null && _b !== void 0 ? _b : existingWebhook.transactionTypes,
|
|
390
|
-
accountAddresses: (_c = editWebhookRequest.accountAddresses) !== null && _c !== void 0 ? _c : existingWebhook.accountAddresses,
|
|
391
|
-
accountAddressOwners: (_d = editWebhookRequest.accountAddressOwners) !== null && _d !== void 0 ? _d : existingWebhook.accountAddressOwners,
|
|
392
|
-
webhookType: (_e = editWebhookRequest.webhookType) !== null && _e !== void 0 ? _e : existingWebhook.webhookType,
|
|
393
|
-
authHeader: (_f = editWebhookRequest.authHeader) !== null && _f !== void 0 ? _f : existingWebhook.authHeader,
|
|
394
|
-
txnStatus: (_g = editWebhookRequest.txnStatus) !== null && _g !== void 0 ? _g : existingWebhook.txnStatus,
|
|
395
|
-
encoding: (_h = editWebhookRequest.encoding) !== null && _h !== void 0 ? _h : existingWebhook.encoding,
|
|
396
|
-
};
|
|
397
|
-
const { data } = yield axios_1.default.put(this.getApiEndpoint(`/v0/webhooks/${webhookID}`), editRequest);
|
|
398
|
-
return data;
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
handleImageUpload(mintApiRequest) {
|
|
402
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
403
|
-
if (mintApiRequest.imagePath && mintApiRequest.imageUrl) {
|
|
404
|
-
throw new Error('Cannot provide both imagePath and imageUrl. Please only provide one.');
|
|
405
|
-
}
|
|
406
|
-
if (mintApiRequest.imagePath && !mintApiRequest.walletPrivateKey) {
|
|
407
|
-
throw new Error('Must provide wallet privateKey if providing imagePath.');
|
|
408
|
-
}
|
|
409
|
-
if (mintApiRequest.imagePath && mintApiRequest.walletPrivateKey) {
|
|
410
|
-
mintApiRequest.imageUrl = yield this.uploadImageToArweave(mintApiRequest.imagePath, mintApiRequest.walletPrivateKey);
|
|
411
|
-
}
|
|
412
|
-
delete mintApiRequest.imagePath;
|
|
413
|
-
delete mintApiRequest.walletPrivateKey;
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
uploadImageToArweave(imagePath, privateKey) {
|
|
417
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
418
|
-
const stats = fs.statSync(imagePath);
|
|
419
|
-
const fileSizeInBytes = stats.size;
|
|
420
|
-
const fileSizeInKB = fileSizeInBytes / 1000;
|
|
421
|
-
if (this.cluster === 'devnet' || fileSizeInKB >= 200) {
|
|
422
|
-
}
|
|
423
|
-
try {
|
|
424
|
-
return '';
|
|
425
|
-
}
|
|
426
|
-
catch (e) {
|
|
427
|
-
throw new Error(`error uploading image to Arweave: ${e}`);
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
getCollectionAuthorityRecord(collectionMint, collectionAuthority) {
|
|
432
|
-
const [collectionAuthRecordPda] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
433
|
-
Buffer.from('metadata'),
|
|
434
|
-
mpl_token_metadata_1.PROGRAM_ID.toBuffer(),
|
|
435
|
-
collectionMint.toBuffer(),
|
|
436
|
-
Buffer.from('collection_authority'),
|
|
437
|
-
collectionAuthority.toBuffer(),
|
|
438
|
-
], mpl_token_metadata_1.PROGRAM_ID);
|
|
439
|
-
return collectionAuthRecordPda;
|
|
440
|
-
}
|
|
441
|
-
getCollectionMetadataAccount(collectionMint) {
|
|
442
|
-
const [collectionMetadataAccount] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
443
|
-
Buffer.from('metadata', 'utf8'),
|
|
444
|
-
mpl_token_metadata_1.PROGRAM_ID.toBuffer(),
|
|
445
|
-
collectionMint.toBuffer(),
|
|
446
|
-
], mpl_token_metadata_1.PROGRAM_ID);
|
|
447
|
-
return collectionMetadataAccount;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
exports.Helius = Helius;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { BlockhashWithExpiryBlockHeight, VersionedTransaction, AddressLookupTableAccount, Transaction, TransactionInstruction, TransactionSignature, Commitment, PublicKey, AccountInfo, GetLatestBlockhashConfig, RpcResponseAndContext, SignatureResult, Blockhash, Connection, ParsedAccountData, SendOptions, Signer, SerializeConfig } from '@solana/web3.js';
|
|
2
|
-
import { DAS } from './types/das-types';
|
|
3
|
-
import { GetPriorityFeeEstimateRequest, GetPriorityFeeEstimateResponse, JitoRegion, PollTransactionOptions, SmartTransactionContext, HeliusSendOptions } from './types';
|
|
4
|
-
import { SolanaTradeRuntimeType } from '../../types';
|
|
5
|
-
import { JitoJsonRpcClient } from '../jito';
|
|
6
|
-
export type SendAndConfirmTransactionResponse = {
|
|
7
|
-
signature: TransactionSignature;
|
|
8
|
-
confirmResponse: RpcResponseAndContext<SignatureResult>;
|
|
9
|
-
blockhash: Blockhash;
|
|
10
|
-
lastValidBlockHeight: number;
|
|
11
|
-
};
|
|
12
|
-
export declare class RpcClient {
|
|
13
|
-
protected readonly connection: Connection;
|
|
14
|
-
protected readonly id?: string;
|
|
15
|
-
jitoClient: JitoJsonRpcClient;
|
|
16
|
-
constructor(connection: Connection, id?: string);
|
|
17
|
-
airdrop(publicKey: PublicKey, lamports: number, commitment?: Commitment): Promise<SendAndConfirmTransactionResponse>;
|
|
18
|
-
getLatestBlockhash(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<BlockhashWithExpiryBlockHeight>;
|
|
19
|
-
getCurrentTPS(): Promise<number>;
|
|
20
|
-
getStakeAccounts(wallet: string): Promise<any>;
|
|
21
|
-
getTokenHolders(mintAddress: string): Promise<{
|
|
22
|
-
pubkey: PublicKey;
|
|
23
|
-
account: AccountInfo<ParsedAccountData | Buffer>;
|
|
24
|
-
}[]>;
|
|
25
|
-
getAsset(params: DAS.GetAssetRequest | string): Promise<DAS.GetAssetResponse>;
|
|
26
|
-
getRwaAsset(params: DAS.GetRwaAssetRequest): Promise<DAS.GetRwaAssetResponse>;
|
|
27
|
-
getAssetBatch(params: DAS.GetAssetBatchRequest): Promise<DAS.GetAssetResponse[]>;
|
|
28
|
-
getAssetProof(params: DAS.GetAssetProofRequest): Promise<DAS.GetAssetProofResponse>;
|
|
29
|
-
getAssetsByGroup(params: DAS.AssetsByGroupRequest): Promise<DAS.GetAssetResponseList>;
|
|
30
|
-
getAssetsByOwner(params: DAS.AssetsByOwnerRequest): Promise<DAS.GetAssetResponseList>;
|
|
31
|
-
getAssetsByCreator(params: DAS.AssetsByCreatorRequest): Promise<DAS.GetAssetResponseList>;
|
|
32
|
-
getAssetsByAuthority(params: DAS.AssetsByAuthorityRequest): Promise<DAS.GetAssetResponseList>;
|
|
33
|
-
searchAssets(params: DAS.SearchAssetsRequest): Promise<DAS.GetAssetResponseList>;
|
|
34
|
-
getSignaturesForAsset(params: DAS.GetSignaturesForAssetRequest): Promise<DAS.GetSignaturesForAssetResponse>;
|
|
35
|
-
getPriorityFeeEstimate(params: GetPriorityFeeEstimateRequest): Promise<GetPriorityFeeEstimateResponse>;
|
|
36
|
-
getComputeUnits(instructions: TransactionInstruction[], payer: PublicKey, lookupTables: AddressLookupTableAccount[], signers?: Signer[]): Promise<number | null>;
|
|
37
|
-
pollTransactionConfirmation(txtSig: TransactionSignature, pollOptions?: PollTransactionOptions): Promise<TransactionSignature>;
|
|
38
|
-
createSmartTransaction(solana_trade_runtime: SolanaTradeRuntimeType, instructions: TransactionInstruction[], signers: Signer[], lookupTables?: AddressLookupTableAccount[], feePayer?: Signer, serializeOptions?: SerializeConfig): Promise<SmartTransactionContext>;
|
|
39
|
-
sendSmartTransaction(solana_trade_runtime: SolanaTradeRuntimeType, instructions: TransactionInstruction[], signers: Signer[], lookupTables?: AddressLookupTableAccount[], sendOptions?: SendOptions & {
|
|
40
|
-
feePayer?: Signer;
|
|
41
|
-
lastValidBlockHeightOffset?: number;
|
|
42
|
-
}): Promise<TransactionSignature>;
|
|
43
|
-
addTipInstruction(instructions: TransactionInstruction[], feePayer: PublicKey, tipAccount: string, tipAmount: number): void;
|
|
44
|
-
getTipTransaction(singers: Signer[], tipAccount: string, tipAmount: number, blockhash: string): Transaction;
|
|
45
|
-
createSmartTransactionWithTip(solana_trade_runtime: SolanaTradeRuntimeType, instructions: TransactionInstruction[], signers: Signer[], lookupTables?: AddressLookupTableAccount[], tipAmount?: number, feePayer?: Signer): Promise<SmartTransactionContext>;
|
|
46
|
-
sendJitoBundle(serializedTransactions: string[], encoding: string, jitoApiUrl: string): Promise<string>;
|
|
47
|
-
getBundleStatuses(bundleIds: string[], jitoApiUrl: string): Promise<any>;
|
|
48
|
-
sendSmartTransactionWithTip(solana_trade_runtime: SolanaTradeRuntimeType, instructions: TransactionInstruction[], signers: Signer[], lookupTables?: AddressLookupTableAccount[], tipAmount?: number, region?: JitoRegion, feePayer?: Signer, lastValidBlockHeightOffset?: number): Promise<string>;
|
|
49
|
-
send_jup_ag_tx_by_jito(solana_trade_runtime: SolanaTradeRuntimeType, transaction: VersionedTransaction, signers: Signer[], tipAmount?: number, region?: JitoRegion): Promise<string>;
|
|
50
|
-
getSerializedTipTransaction(signers: Signer[], tipAmount: number, blockhash: string, encoding?: BufferEncoding): Promise<string>;
|
|
51
|
-
private redirectTransactionToExternalServers;
|
|
52
|
-
getNftEditions(params: DAS.GetNftEditionsRequest): Promise<DAS.GetNftEditionsResponse>;
|
|
53
|
-
getTokenAccounts(params: DAS.GetTokenAccountsRequest): Promise<DAS.GetTokenAccountsResponse>;
|
|
54
|
-
sendTransaction(transaction: Transaction | VersionedTransaction, options?: HeliusSendOptions): Promise<TransactionSignature>;
|
|
55
|
-
sendSmartTransactionWithTipMixed(solana_trade_runtime: SolanaTradeRuntimeType, instructions: TransactionInstruction[], signers: Signer[], lookupTables?: AddressLookupTableAccount[], tipAmount?: number, region?: JitoRegion, feePayer?: Signer, lastValidBlockHeightOffset?: number): Promise<string>;
|
|
56
|
-
sendJitoTransaction(serializedTransaction: string, jitoApiUrl: string, encoding?: string): Promise<string>;
|
|
57
|
-
get_last_blockhash_slot(connections: Connection[]): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
|
|
58
|
-
getBlockhashBySlotOffset(targetSlotOffset?: number, limit?: number): Promise<{
|
|
59
|
-
key: string;
|
|
60
|
-
context: {
|
|
61
|
-
slot: number;
|
|
62
|
-
};
|
|
63
|
-
value: {
|
|
64
|
-
blockhash: string;
|
|
65
|
-
lastValidBlockHeight: number;
|
|
66
|
-
};
|
|
67
|
-
}>;
|
|
68
|
-
try_get_bundle_failed_result(txid: string, bundle_id: string, timeoutMs?: number): Promise<void>;
|
|
69
|
-
send_tx_to_all_jito_region(serializedTransaction: string, encoding: string): Promise<string>;
|
|
70
|
-
}
|