@hawksightco/hawk-sdk 1.1.49 → 1.1.50
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/src/classes/AltStorage.d.ts +29 -0
- package/dist/src/classes/AltStorage.d.ts.map +1 -0
- package/dist/src/classes/AltStorage.js +58 -0
- package/dist/src/classes/HawkAPI.d.ts +3 -0
- package/dist/src/classes/HawkAPI.d.ts.map +1 -1
- package/dist/src/classes/HawkAPI.js +2 -0
- package/dist/src/classes/SimpleIxGenerator.d.ts +5 -0
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +1 -1
- package/dist/src/classes/SimpleIxGenerator.js +5 -0
- package/dist/src/classes/SimplePdaGenerator.d.ts +28 -0
- package/dist/src/classes/SimplePdaGenerator.d.ts.map +1 -0
- package/dist/src/classes/SimplePdaGenerator.js +33 -0
- package/dist/src/classes/Transactions.d.ts +1 -1
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +3 -17
- package/dist/src/classes/TxGenerator.d.ts +39 -1
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +91 -0
- package/dist/src/functions.d.ts +2 -0
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +7 -5
- package/dist/src/hawksight.d.ts +1 -0
- package/dist/src/hawksight.d.ts.map +1 -1
- package/dist/src/hawksight.js +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +48 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +77 -0
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts +20 -0
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/UtilIxGenerator.js +25 -0
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts +23 -0
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/HawksightPdaGenerator.js +56 -0
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts +6 -0
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.js +9 -0
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts +15 -0
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/OrcaPdaGenerator.js +45 -0
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts +6 -0
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.js +9 -0
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts +8 -0
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/UtilPdaGenerator.js +41 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
export declare class AltStorage {
|
|
3
|
+
private static _instance;
|
|
4
|
+
static instance(): AltStorage;
|
|
5
|
+
/**
|
|
6
|
+
* Override property to override behavior of this class
|
|
7
|
+
*/
|
|
8
|
+
override: {
|
|
9
|
+
loadSingleAlt: (alt: string, connection?: web3.Connection) => Promise<web3.AddressLookupTableAccount>;
|
|
10
|
+
getAlt: (alt: string) => Promise<web3.AddressLookupTableAccount | null>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Loads a single address lookup table account.
|
|
14
|
+
*
|
|
15
|
+
* @param alt - The address lookup table account address as a string.
|
|
16
|
+
* @param connection - (Optional) A specific Solana blockchain connection object to use.
|
|
17
|
+
* @returns A promise that resolves to the address lookup table account.
|
|
18
|
+
* @throws Error if the address lookup table does not exist.
|
|
19
|
+
*/
|
|
20
|
+
loadSingleAlt(alt: string, connection?: web3.Connection): Promise<web3.AddressLookupTableAccount>;
|
|
21
|
+
/**
|
|
22
|
+
* Gets an address lookup table account.
|
|
23
|
+
*
|
|
24
|
+
* @param alt - The address lookup table account address as a string.
|
|
25
|
+
* @returns A promise that resolves to the address lookup table account or null if it does not exist.
|
|
26
|
+
*/
|
|
27
|
+
getAlt(alt: string): Promise<web3.AddressLookupTableAccount | null>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=AltStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltStorage.d.ts","sourceRoot":"","sources":["../../../src/classes/AltStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,qBAAa,UAAU;IAErB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAa;IACrC,MAAM,CAAC,QAAQ;IAOf;;OAEG;IACH,QAAQ,EAAE;QACR,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACtG,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;KACxE,CAOA;IACD;;;;;;;OAOG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;IAIvG;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;CAG1E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AltStorage = void 0;
|
|
13
|
+
class AltStorage {
|
|
14
|
+
constructor() {
|
|
15
|
+
/**
|
|
16
|
+
* Override property to override behavior of this class
|
|
17
|
+
*/
|
|
18
|
+
this.override = {
|
|
19
|
+
loadSingleAlt: (alt, connection) => {
|
|
20
|
+
throw new Error('Not yet implemented.');
|
|
21
|
+
},
|
|
22
|
+
getAlt: (alt) => {
|
|
23
|
+
throw new Error('Not yet implemented.');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static instance() {
|
|
28
|
+
if (this._instance === undefined) {
|
|
29
|
+
this._instance = new AltStorage();
|
|
30
|
+
}
|
|
31
|
+
return this._instance;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Loads a single address lookup table account.
|
|
35
|
+
*
|
|
36
|
+
* @param alt - The address lookup table account address as a string.
|
|
37
|
+
* @param connection - (Optional) A specific Solana blockchain connection object to use.
|
|
38
|
+
* @returns A promise that resolves to the address lookup table account.
|
|
39
|
+
* @throws Error if the address lookup table does not exist.
|
|
40
|
+
*/
|
|
41
|
+
loadSingleAlt(alt, connection) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return yield this.override.loadSingleAlt(alt, connection);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets an address lookup table account.
|
|
48
|
+
*
|
|
49
|
+
* @param alt - The address lookup table account address as a string.
|
|
50
|
+
* @returns A promise that resolves to the address lookup table account or null if it does not exist.
|
|
51
|
+
*/
|
|
52
|
+
getAlt(alt) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return this.override.getAlt(alt);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.AltStorage = AltStorage;
|
|
@@ -12,6 +12,7 @@ import { TransactionBatchExecute, TransactionBatchExecuteParams } from "./Transa
|
|
|
12
12
|
import { Atomicity } from "./Atomicity";
|
|
13
13
|
import { JupiterAlts } from "./JupiterAlts";
|
|
14
14
|
import { JupiterSwap } from "./JupiterSwap";
|
|
15
|
+
import { SimplePdaGenerator } from './SimplePdaGenerator';
|
|
15
16
|
/**
|
|
16
17
|
* HawkAPI is a central gateway class that aggregates access to various functional modules
|
|
17
18
|
* for interacting with HawkSight's blockchain APIs. This class initializes and exposes modules
|
|
@@ -47,6 +48,8 @@ export declare class HawkAPI {
|
|
|
47
48
|
readonly jupAlts: JupiterAlts;
|
|
48
49
|
/** Jupiter swap */
|
|
49
50
|
readonly jupiterSwap: JupiterSwap;
|
|
51
|
+
/** Simple PDA generator */
|
|
52
|
+
readonly pda: SimplePdaGenerator;
|
|
50
53
|
/**
|
|
51
54
|
* Initializes a new instance of the HawkAPI class with a specified API URL.
|
|
52
55
|
* @param url The base URL for the HawkSight API services, defaulted to "https://api2.hawksight.co" if not specified.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HawkAPI.d.ts","sourceRoot":"","sources":["../../../src/classes/HawkAPI.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EA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AAK,EAAE,UAAU,EAAE,OAAO,EAAC,EAAE,6BAA6B;IAW5G;;;;OAIG;IACH,SAAS,CAAC,EAAC,oBAAoB,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAC,EAAE,6BAA6B;IAYzG;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,OAAO;CAGtB"}
|
|
@@ -17,6 +17,7 @@ const JupiterAlts_1 = require("./JupiterAlts");
|
|
|
17
17
|
const JupiterSwap_1 = require("./JupiterSwap");
|
|
18
18
|
const Logging_1 = require("./Logging");
|
|
19
19
|
const Transactions_1 = require("./Transactions");
|
|
20
|
+
const SimplePdaGenerator_1 = require("./SimplePdaGenerator");
|
|
20
21
|
/**
|
|
21
22
|
* HawkAPI is a central gateway class that aggregates access to various functional modules
|
|
22
23
|
* for interacting with HawkSight's blockchain APIs. This class initializes and exposes modules
|
|
@@ -48,6 +49,7 @@ class HawkAPI {
|
|
|
48
49
|
this.jupAlts = new JupiterAlts_1.JupiterAlts();
|
|
49
50
|
this.jupiterSwap = new JupiterSwap_1.JupiterSwap(this.ix);
|
|
50
51
|
Transactions_1.txgen.ix = this.ix;
|
|
52
|
+
this.pda = new SimplePdaGenerator_1.SimplePdaGenerator();
|
|
51
53
|
// Load create tx metadata module
|
|
52
54
|
if (this.options === undefined || !this.options.disableTxMetadataLoad) {
|
|
53
55
|
CreateTxMetadata_1.CreateTxMetadata.instance().load();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IyfExtensionIxGenerator } from "../ixGenerator/IyfExtensionIxGenerator";
|
|
2
2
|
import { IyfMainIxGenerator } from "../ixGenerator/IyfMainIxGenerator";
|
|
3
3
|
import { MeteoraDlmmIxGenerator } from "../ixGenerator/MeteoraDlmmIxGenerator";
|
|
4
|
+
import { UtilIxGenerator } from "../ixGenerator/UtilIxGenerator";
|
|
4
5
|
/**
|
|
5
6
|
* The SimpleIxGenerator class is a general-purpose utility for generating single
|
|
6
7
|
* transaction instructions for simple tasks on the Solana blockchain. It offers
|
|
@@ -8,6 +9,10 @@ import { MeteoraDlmmIxGenerator } from "../ixGenerator/MeteoraDlmmIxGenerator";
|
|
|
8
9
|
* interacting with the user's PDA (Program Derived Address) account.
|
|
9
10
|
*/
|
|
10
11
|
export declare class SimpleIxGenerator {
|
|
12
|
+
/**
|
|
13
|
+
* Util IX generator (other tx generators)
|
|
14
|
+
*/
|
|
15
|
+
util: UtilIxGenerator;
|
|
11
16
|
/**
|
|
12
17
|
* IYF Main Instruction Generator
|
|
13
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/SimpleIxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"SimpleIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/SimpleIxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,iBAAiB;IAE5B;;OAEG;IACI,IAAI,EAAE,eAAe,CAAyB;IAErD;;OAEG;IACI,OAAO,EAAE,kBAAkB,CAA4B;IAE9D;;OAEG;IACI,YAAY,EAAE,uBAAuB,CAA6C;IAEzF;;OAEG;IACI,WAAW,EAAE,sBAAsB,CAA4C;CACvF"}
|
|
@@ -4,6 +4,7 @@ exports.SimpleIxGenerator = void 0;
|
|
|
4
4
|
const IyfExtensionIxGenerator_1 = require("../ixGenerator/IyfExtensionIxGenerator");
|
|
5
5
|
const IyfMainIxGenerator_1 = require("../ixGenerator/IyfMainIxGenerator");
|
|
6
6
|
const MeteoraDlmmIxGenerator_1 = require("../ixGenerator/MeteoraDlmmIxGenerator");
|
|
7
|
+
const UtilIxGenerator_1 = require("../ixGenerator/UtilIxGenerator");
|
|
7
8
|
/**
|
|
8
9
|
* The SimpleIxGenerator class is a general-purpose utility for generating single
|
|
9
10
|
* transaction instructions for simple tasks on the Solana blockchain. It offers
|
|
@@ -12,6 +13,10 @@ const MeteoraDlmmIxGenerator_1 = require("../ixGenerator/MeteoraDlmmIxGenerator"
|
|
|
12
13
|
*/
|
|
13
14
|
class SimpleIxGenerator {
|
|
14
15
|
constructor() {
|
|
16
|
+
/**
|
|
17
|
+
* Util IX generator (other tx generators)
|
|
18
|
+
*/
|
|
19
|
+
this.util = new UtilIxGenerator_1.UtilIxGenerator();
|
|
15
20
|
/**
|
|
16
21
|
* IYF Main Instruction Generator
|
|
17
22
|
*/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HawksightPdaGenerator } from "../pdaGenerator/HawksightPdaGenerator";
|
|
2
|
+
import { MeteoraPdaGenerator } from "../pdaGenerator/MeteoraPdaGenerator";
|
|
3
|
+
import { OrcaPdaGenerator } from "../pdaGenerator/OrcaPdaGenerator";
|
|
4
|
+
import { RaydiumPdaGenerator } from "../pdaGenerator/RaydiumPdaGenerator";
|
|
5
|
+
import { UtilPdaGenerator } from "../pdaGenerator/UtilPdaGenerator";
|
|
6
|
+
export declare class SimplePdaGenerator {
|
|
7
|
+
/**
|
|
8
|
+
* Util PDA Generator (Other PDA generators / uncategorized)
|
|
9
|
+
*/
|
|
10
|
+
util: UtilPdaGenerator;
|
|
11
|
+
/**
|
|
12
|
+
* Hawksight PDA Generator
|
|
13
|
+
*/
|
|
14
|
+
hawksight: HawksightPdaGenerator;
|
|
15
|
+
/**
|
|
16
|
+
* Meteora PDA Generator
|
|
17
|
+
*/
|
|
18
|
+
meteora: MeteoraPdaGenerator;
|
|
19
|
+
/**
|
|
20
|
+
* Meteora PDA Generator
|
|
21
|
+
*/
|
|
22
|
+
orca: OrcaPdaGenerator;
|
|
23
|
+
/**
|
|
24
|
+
* Meteora PDA Generator
|
|
25
|
+
*/
|
|
26
|
+
raydium: RaydiumPdaGenerator;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=SimplePdaGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimplePdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/SimplePdaGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,qBAAa,kBAAkB;IAE7B;;OAEG;IACI,IAAI,EAAE,gBAAgB,CAA0B;IAEvD;;OAEG;IACI,SAAS,EAAE,qBAAqB,CAA+B;IAEtE;;OAEG;IACI,OAAO,EAAE,mBAAmB,CAA6B;IAEhE;;OAEG;IACI,IAAI,EAAE,gBAAgB,CAA0B;IAEvD;;OAEG;IACI,OAAO,EAAE,mBAAmB,CAA6B;CACjE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SimplePdaGenerator = void 0;
|
|
4
|
+
const HawksightPdaGenerator_1 = require("../pdaGenerator/HawksightPdaGenerator");
|
|
5
|
+
const MeteoraPdaGenerator_1 = require("../pdaGenerator/MeteoraPdaGenerator");
|
|
6
|
+
const OrcaPdaGenerator_1 = require("../pdaGenerator/OrcaPdaGenerator");
|
|
7
|
+
const RaydiumPdaGenerator_1 = require("../pdaGenerator/RaydiumPdaGenerator");
|
|
8
|
+
const UtilPdaGenerator_1 = require("../pdaGenerator/UtilPdaGenerator");
|
|
9
|
+
class SimplePdaGenerator {
|
|
10
|
+
constructor() {
|
|
11
|
+
/**
|
|
12
|
+
* Util PDA Generator (Other PDA generators / uncategorized)
|
|
13
|
+
*/
|
|
14
|
+
this.util = new UtilPdaGenerator_1.UtilPdaGenerator();
|
|
15
|
+
/**
|
|
16
|
+
* Hawksight PDA Generator
|
|
17
|
+
*/
|
|
18
|
+
this.hawksight = new HawksightPdaGenerator_1.HawksightPdaGenerator();
|
|
19
|
+
/**
|
|
20
|
+
* Meteora PDA Generator
|
|
21
|
+
*/
|
|
22
|
+
this.meteora = new MeteoraPdaGenerator_1.MeteoraPdaGenerator();
|
|
23
|
+
/**
|
|
24
|
+
* Meteora PDA Generator
|
|
25
|
+
*/
|
|
26
|
+
this.orca = new OrcaPdaGenerator_1.OrcaPdaGenerator();
|
|
27
|
+
/**
|
|
28
|
+
* Meteora PDA Generator
|
|
29
|
+
*/
|
|
30
|
+
this.raydium = new RaydiumPdaGenerator_1.RaydiumPdaGenerator();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.SimplePdaGenerator = SimplePdaGenerator;
|
|
@@ -131,7 +131,7 @@ export declare class Transactions {
|
|
|
131
131
|
* @param params Parameters required.
|
|
132
132
|
* @returns A Promise resolving to the transaction metadata or an error response, depending on the outcome of the registration.
|
|
133
133
|
*/
|
|
134
|
-
initializeStorageTokenAccounts({ connection, params, }: TxgenParams<InitializeStorageTokenAccount>): Promise<TransactionMetadataResponse |
|
|
134
|
+
initializeStorageTokenAccounts({ connection, params, }: TxgenParams<InitializeStorageTokenAccount>): Promise<TransactionMetadataResponse | null>;
|
|
135
135
|
limitCloseAutomationIx({ connection, params, }: TxgenParams<MeteoraLimitCloseAutomation>): Promise<TransactionMetadataResponse>;
|
|
136
136
|
private removeLiquidityByRangeInfo;
|
|
137
137
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAiBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAGR,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,UAAU,CAAC;AA+BlB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,YAAY;IAEvB;;OAEG;IACH,OAAO;IAIP;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IAEtC;;OAEG;IACI,EAAE,EAAE,iBAAiB,CAAC;IAE7B;;;;OAIG;IACH,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;;;;;OAMG;IACH,eAAe,CACb,UAAU,EAAE,IAAI,CAAC,SAAS,EAC1B,IAAI,GAAE,IAAI,CAAC,SAAqB,GAC/B,IAAI,CAAC,SAAS;IAIjB;;;;;;;OAOG;IACG,QAAQ,CAAC,EACb,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAqD/D;;;;;;;OAOG;IACG,+BAA+B,CAAC,EACpC,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,+BAA+B,CAAC,GAAG,OAA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EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA2F3G;;;;;;;OAOG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAsFpH;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
|
|
@@ -649,7 +649,7 @@ class Transactions {
|
|
|
649
649
|
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
650
650
|
if (!!params.useAta) {
|
|
651
651
|
removeLiquidityBuilder.replaceClaimFeeTokenToATA();
|
|
652
|
-
removeLiquidityBuilder.
|
|
652
|
+
removeLiquidityBuilder.replaceClaimRewardToSTA();
|
|
653
653
|
}
|
|
654
654
|
else {
|
|
655
655
|
removeLiquidityBuilder.replaceClaimFeeTokenToSTA();
|
|
@@ -737,7 +737,7 @@ class Transactions {
|
|
|
737
737
|
mainInstructions,
|
|
738
738
|
});
|
|
739
739
|
}
|
|
740
|
-
return
|
|
740
|
+
return null;
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
limitCloseAutomationIx(_a) {
|
|
@@ -1312,21 +1312,7 @@ class Transactions {
|
|
|
1312
1312
|
iyfExtensionProgram: addresses_1.IYF_EXTENSION,
|
|
1313
1313
|
})
|
|
1314
1314
|
.remainingAccounts([
|
|
1315
|
-
extensionIx.keys
|
|
1316
|
-
extensionIx.keys[5],
|
|
1317
|
-
extensionIx.keys[6],
|
|
1318
|
-
extensionIx.keys[7],
|
|
1319
|
-
extensionIx.keys[8],
|
|
1320
|
-
extensionIx.keys[9],
|
|
1321
|
-
extensionIx.keys[10],
|
|
1322
|
-
extensionIx.keys[11],
|
|
1323
|
-
extensionIx.keys[12],
|
|
1324
|
-
extensionIx.keys[13],
|
|
1325
|
-
extensionIx.keys[14],
|
|
1326
|
-
extensionIx.keys[15],
|
|
1327
|
-
extensionIx.keys[16],
|
|
1328
|
-
extensionIx.keys[17],
|
|
1329
|
-
extensionIx.keys[18],
|
|
1315
|
+
...extensionIx.keys.slice(4)
|
|
1330
1316
|
])
|
|
1331
1317
|
.instruction();
|
|
1332
1318
|
const withdrawFromPda = yield (0, hawksight_1.withdrawMultipleToken)({
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import * as web3 from "@solana/web3.js";
|
|
2
2
|
import * as _client from "@hawksightco/swagger-client";
|
|
3
|
-
import { ResponseWithStatus, TransactionMetadata, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll, MeteoraCreatePositionAndDepositPda } from "../types";
|
|
3
|
+
import { ResponseWithStatus, TransactionMetadata, TransactionMetadataResponse, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll, MeteoraCreatePositionAndDepositPda, InitializeStorageTokenAccount } from "../types";
|
|
4
4
|
import { Client } from "./Client";
|
|
5
5
|
import { GeneralUtility } from "./GeneralUtility";
|
|
6
6
|
import { MultiTransaction } from "./MultiTransaction";
|
|
7
|
+
import { SimpleIxGenerator } from "./SimpleIxGenerator";
|
|
8
|
+
import { SimplePdaGenerator } from "./SimplePdaGenerator";
|
|
9
|
+
type ClaimTokenFromSTA = {
|
|
10
|
+
connection: web3.Connection;
|
|
11
|
+
userWallet: web3.PublicKey;
|
|
12
|
+
mint: web3.PublicKey;
|
|
13
|
+
};
|
|
14
|
+
type ClaimTokensFromSTA = {
|
|
15
|
+
connection: web3.Connection;
|
|
16
|
+
userWallet: web3.PublicKey;
|
|
17
|
+
mints: web3.PublicKey[];
|
|
18
|
+
};
|
|
7
19
|
/**
|
|
8
20
|
* The `TxGenerator` class encapsulates methods to generate transactions with various trading operations
|
|
9
21
|
* on decentralized market making platforms like Meteora and Orca within the Solana ecosystem. It allows
|
|
@@ -12,12 +24,37 @@ import { MultiTransaction } from "./MultiTransaction";
|
|
|
12
24
|
export declare class TxGenerator {
|
|
13
25
|
private readonly client;
|
|
14
26
|
protected readonly generalUtility: GeneralUtility;
|
|
27
|
+
/**
|
|
28
|
+
* Simple IX Generator instance (overridable)
|
|
29
|
+
*/
|
|
30
|
+
ix: SimpleIxGenerator;
|
|
31
|
+
/**
|
|
32
|
+
* Simple PDA Generator instance (overridable)
|
|
33
|
+
*/
|
|
34
|
+
pda: SimplePdaGenerator;
|
|
15
35
|
/**
|
|
16
36
|
* Initializes a new instance of the TxGenerator class with a specified client.
|
|
17
37
|
*
|
|
18
38
|
* @param client An instance of Client used to interact with various APIs for transaction generation.
|
|
19
39
|
*/
|
|
20
40
|
constructor(client: Client, generalUtility: GeneralUtility);
|
|
41
|
+
/**
|
|
42
|
+
* Claim token from STA. Fallbacks to ATA if STA is not yet initialized.
|
|
43
|
+
*
|
|
44
|
+
* Note: Subject to refactor. Dirty implementation.
|
|
45
|
+
*
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
claimTokenFromSta({ connection, userWallet, mint }: ClaimTokenFromSTA): Promise<TransactionMetadataResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Claim tokens from STA.
|
|
51
|
+
*
|
|
52
|
+
* Note: Subject to refactor. Dirty implementation.
|
|
53
|
+
*
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
claimTokensFromSta({ connection, userWallet, mints }: ClaimTokensFromSTA): Promise<TransactionMetadataResponse>;
|
|
57
|
+
initializeStorageTokenAccounts(connection: web3.Connection, params: InitializeStorageTokenAccount): Promise<TransactionMetadataResponse | null>;
|
|
21
58
|
/**
|
|
22
59
|
* Creates meteora instruction that creates new position and deposit.
|
|
23
60
|
*
|
|
@@ -145,4 +182,5 @@ export declare class TxGenerator {
|
|
|
145
182
|
*/
|
|
146
183
|
orcaClaimRewards(connection: web3.Connection, payer: string, params: OrcaClaimRewards): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
147
184
|
}
|
|
185
|
+
export {};
|
|
148
186
|
//# sourceMappingURL=TxGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,2BAA2B,EAAqC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,kCAAkC,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AACzS,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;IAC5B,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;CACtB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;IAC5B,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,CAA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EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAgChJ;;;;;;;OAOG;IACG,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAmCpI;;;;;;;OAOG;IACG,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAiCtI;;;;;;;OAOG;IACG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA+B/I"}
|
|
@@ -39,6 +39,9 @@ const anchor_1 = require("../anchor");
|
|
|
39
39
|
const Transactions_1 = require("./Transactions");
|
|
40
40
|
const bn_js_1 = require("bn.js");
|
|
41
41
|
const Logging_1 = require("./Logging");
|
|
42
|
+
const SimpleIxGenerator_1 = require("./SimpleIxGenerator");
|
|
43
|
+
const SimplePdaGenerator_1 = require("./SimplePdaGenerator");
|
|
44
|
+
const addresses_1 = require("../addresses");
|
|
42
45
|
/**
|
|
43
46
|
* The `TxGenerator` class encapsulates methods to generate transactions with various trading operations
|
|
44
47
|
* on decentralized market making platforms like Meteora and Orca within the Solana ecosystem. It allows
|
|
@@ -53,6 +56,94 @@ class TxGenerator {
|
|
|
53
56
|
constructor(client, generalUtility) {
|
|
54
57
|
this.client = client;
|
|
55
58
|
this.generalUtility = generalUtility;
|
|
59
|
+
this.ix = new SimpleIxGenerator_1.SimpleIxGenerator();
|
|
60
|
+
this.pda = new SimplePdaGenerator_1.SimplePdaGenerator();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Claim token from STA. Fallbacks to ATA if STA is not yet initialized.
|
|
64
|
+
*
|
|
65
|
+
* Note: Subject to refactor. Dirty implementation.
|
|
66
|
+
*
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
claimTokenFromSta(_a) {
|
|
70
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, mint }) {
|
|
71
|
+
const farm = addresses_1.USDC_FARM;
|
|
72
|
+
const userPda = this.pda.hawksight.generateUserPda(userWallet, farm);
|
|
73
|
+
const mainInstructions = [];
|
|
74
|
+
const result = yield (0, functions_1.tokenAccountExists)(connection, [
|
|
75
|
+
{ owner: userWallet, mint },
|
|
76
|
+
{ owner: userPda, mint },
|
|
77
|
+
{ owner: userPda, mint, isSta: true },
|
|
78
|
+
]);
|
|
79
|
+
if (!result[0].exists) {
|
|
80
|
+
mainInstructions.push(this.ix.util.createAssociatedTokenAccountInstruction({
|
|
81
|
+
payer: userWallet,
|
|
82
|
+
owner: userWallet,
|
|
83
|
+
mint,
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
if (!result[1].exists) {
|
|
87
|
+
mainInstructions.push(this.ix.util.createAssociatedTokenAccountInstruction({
|
|
88
|
+
payer: userWallet,
|
|
89
|
+
owner: userPda,
|
|
90
|
+
mint,
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
if (result[2].exists) {
|
|
94
|
+
mainInstructions.push(yield this.ix.iyfMain.withdrawTokenFromUserPda({ userWallet, mint, useSta: true }));
|
|
95
|
+
}
|
|
96
|
+
mainInstructions.push(yield this.ix.iyfMain.withdrawTokenFromUserPda({ userWallet, mint }));
|
|
97
|
+
return yield (0, functions_1.createTransactionMeta)({
|
|
98
|
+
payer: userWallet,
|
|
99
|
+
description: "Withdraw token from PDA",
|
|
100
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
101
|
+
mainInstructions: mainInstructions,
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Claim tokens from STA.
|
|
107
|
+
*
|
|
108
|
+
* Note: Subject to refactor. Dirty implementation.
|
|
109
|
+
*
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
claimTokensFromSta(_a) {
|
|
113
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, mints }) {
|
|
114
|
+
const farm = addresses_1.USDC_FARM;
|
|
115
|
+
const mainInstructions = [];
|
|
116
|
+
const result = yield (0, functions_1.tokenAccountExists)(connection, [
|
|
117
|
+
...mints.map(mint => {
|
|
118
|
+
return { owner: userWallet, mint };
|
|
119
|
+
}),
|
|
120
|
+
]);
|
|
121
|
+
result.map(result => {
|
|
122
|
+
if (!result.exists) {
|
|
123
|
+
mainInstructions.push(this.ix.util.createAssociatedTokenAccountInstruction({
|
|
124
|
+
payer: userWallet,
|
|
125
|
+
owner: userWallet,
|
|
126
|
+
mint: result.mint,
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
mainInstructions.push(yield this.ix.iyfMain.withdrawMultipleToken({
|
|
131
|
+
payer: userWallet,
|
|
132
|
+
withdraw: mints.map(mint => { return { mint }; }),
|
|
133
|
+
useSta: true,
|
|
134
|
+
}));
|
|
135
|
+
return (0, functions_1.createTransactionMeta)({
|
|
136
|
+
payer: userWallet,
|
|
137
|
+
description: "Withdraw multiple token/s from STA",
|
|
138
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
139
|
+
mainInstructions: mainInstructions,
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
initializeStorageTokenAccounts(connection, params) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
return yield Transactions_1.txgen.initializeStorageTokenAccounts({ connection, params });
|
|
146
|
+
});
|
|
56
147
|
}
|
|
57
148
|
/**
|
|
58
149
|
* Creates meteora instruction that creates new position and deposit.
|
package/dist/src/functions.d.ts
CHANGED
|
@@ -122,7 +122,9 @@ export declare function sighash(ixName: string, prefix?: string): Buffer;
|
|
|
122
122
|
export declare function tokenAccountExists(connection: web3.Connection, params: {
|
|
123
123
|
owner: web3.PublicKey;
|
|
124
124
|
mint: web3.PublicKey;
|
|
125
|
+
isSta?: boolean;
|
|
125
126
|
}[]): Promise<{
|
|
127
|
+
mint: web3.PublicKey;
|
|
126
128
|
tokenKey: web3.PublicKey;
|
|
127
129
|
exists: boolean;
|
|
128
130
|
}[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,EACzB,6BAA6B,EAC7B,WAAW,EACX,mBAAmB,EACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAM1D,OAAO,EAAE,MAAM,OAAO,CAAC;AAKvB,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,mBAAmB,CAAC,CAO9B;AAED,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAOhC;AAED;;;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I,CAAC,SAAS,EAAE,CAAC,CAMnH;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAqBxJ;AAED,eAAO,MAAM,SAAS;UAEZ,MAAM;SACP,MAAM;;UAaX,CAAC"}
|
package/dist/src/functions.js
CHANGED
|
@@ -303,17 +303,19 @@ exports.sighash = sighash;
|
|
|
303
303
|
*/
|
|
304
304
|
function tokenAccountExists(connection, params) {
|
|
305
305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
|
-
const tokenKeys = params.map((p) =>
|
|
306
|
+
const tokenKeys = params.map((p) => {
|
|
307
|
+
// p.owner is assumed to be user pda already
|
|
308
|
+
return p.isSta ? generateUserPdaStorageAccount(p.owner, p.mint) : generateAta(p.owner, p.mint);
|
|
309
|
+
});
|
|
307
310
|
const accountInfos = yield connection.getMultipleAccountsInfo(tokenKeys);
|
|
308
311
|
const result = accountInfos.map((accountInfo, index) => {
|
|
309
312
|
if (accountInfo === null || accountInfo.data.length !== 165) {
|
|
310
|
-
return { tokenKey: tokenKeys[index], exists: false };
|
|
313
|
+
return { mint: params[index].mint, tokenKey: tokenKeys[index], exists: false };
|
|
311
314
|
}
|
|
312
|
-
const tokenInfo = parseTokenAccountData(accountInfo.data);
|
|
313
|
-
const tokenKey = generateAta(tokenInfo.owner, tokenInfo.mint);
|
|
314
315
|
return {
|
|
316
|
+
mint: params[index].mint,
|
|
315
317
|
tokenKey: tokenKeys[index],
|
|
316
|
-
exists:
|
|
318
|
+
exists: accountInfo.owner.equals(addresses_1.TOKEN_PROGRAM_ID),
|
|
317
319
|
};
|
|
318
320
|
});
|
|
319
321
|
return result;
|
package/dist/src/hawksight.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hawksight.d.ts","sourceRoot":"","sources":["../../src/hawksight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,OAAO,CAAC;AAUvB,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;CACL,wCAyCA;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;KACtB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"hawksight.d.ts","sourceRoot":"","sources":["../../src/hawksight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,OAAO,CAAC;AAUvB,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;CACL,wCAyCA;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;KACtB,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,wCAwCA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,wBAAsB,kBAAkB,CAAC,EAAE,UAAU,EAAE,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAUrH;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,wBAAsB,qBAAqB,CAAC,EAAE,UAAU,EAAE,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAUxH;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAsB,UAAU,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAkBtG"}
|
package/dist/src/hawksight.js
CHANGED
|
@@ -90,7 +90,7 @@ function withdrawMultipleToken(params) {
|
|
|
90
90
|
params.withdraw.map((d) => {
|
|
91
91
|
const mint = d.mint;
|
|
92
92
|
const userToken = util.generateAta(params.payer, d.mint);
|
|
93
|
-
const userPdaToken = util.generateAta(userPda, d.mint);
|
|
93
|
+
const userPdaToken = params.useSta ? util.generateUserPdaStorageAccount(userPda, d.mint) : util.generateAta(userPda, d.mint);
|
|
94
94
|
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
95
95
|
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
96
96
|
remainingAccounts.push({
|
package/dist/src/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { TxGenerator } from "./classes/TxGenerator";
|
|
|
5
5
|
export { Client } from "./classes/Client";
|
|
6
6
|
export { CreateTxMetadata } from "./classes/CreateTxMetadata";
|
|
7
7
|
export { TransactionBatchExecute2 } from "./classes/TransactionBatchExecute2";
|
|
8
|
+
export { AltStorage } from './classes/AltStorage';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.TransactionBatchExecute2 = exports.CreateTxMetadata = exports.Client = exports.TxGenerator = exports.HawkAPI = void 0;
|
|
17
|
+
exports.AltStorage = exports.TransactionBatchExecute2 = exports.CreateTxMetadata = exports.Client = exports.TxGenerator = exports.HawkAPI = void 0;
|
|
18
18
|
__exportStar(require("./types"), exports);
|
|
19
19
|
__exportStar(require("./functions"), exports);
|
|
20
20
|
var HawkAPI_1 = require("./classes/HawkAPI");
|
|
@@ -27,3 +27,5 @@ var CreateTxMetadata_1 = require("./classes/CreateTxMetadata");
|
|
|
27
27
|
Object.defineProperty(exports, "CreateTxMetadata", { enumerable: true, get: function () { return CreateTxMetadata_1.CreateTxMetadata; } });
|
|
28
28
|
var TransactionBatchExecute2_1 = require("./classes/TransactionBatchExecute2");
|
|
29
29
|
Object.defineProperty(exports, "TransactionBatchExecute2", { enumerable: true, get: function () { return TransactionBatchExecute2_1.TransactionBatchExecute2; } });
|
|
30
|
+
var AltStorage_1 = require("./classes/AltStorage");
|
|
31
|
+
Object.defineProperty(exports, "AltStorage", { enumerable: true, get: function () { return AltStorage_1.AltStorage; } });
|
|
@@ -28,6 +28,30 @@ export type JupiterRouteIxReturn = {
|
|
|
28
28
|
closeAtaIx: web3.TransactionInstruction;
|
|
29
29
|
ataExists: boolean;
|
|
30
30
|
};
|
|
31
|
+
type DepositMultipleToken = {
|
|
32
|
+
payer: web3.PublicKey;
|
|
33
|
+
deposit: {
|
|
34
|
+
mint: web3.PublicKey;
|
|
35
|
+
amount: BN;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
type WithdrawMultipleToken = {
|
|
39
|
+
payer: web3.PublicKey;
|
|
40
|
+
withdraw: {
|
|
41
|
+
mint: web3.PublicKey;
|
|
42
|
+
}[];
|
|
43
|
+
useSta?: boolean;
|
|
44
|
+
};
|
|
45
|
+
type DepositTokenFromUserPda = {
|
|
46
|
+
userWallet: web3.PublicKey;
|
|
47
|
+
mint: web3.PublicKey;
|
|
48
|
+
amount: BN;
|
|
49
|
+
};
|
|
50
|
+
type WithdrawTokenFromUserPda = {
|
|
51
|
+
userWallet: web3.PublicKey;
|
|
52
|
+
mint: web3.PublicKey;
|
|
53
|
+
useSta?: boolean;
|
|
54
|
+
};
|
|
31
55
|
/**
|
|
32
56
|
* Iyf Main IX Generator
|
|
33
57
|
*/
|
|
@@ -66,6 +90,30 @@ export declare class IyfMainIxGenerator {
|
|
|
66
90
|
*/
|
|
67
91
|
iyfExtensionExecute(connection: web3.Connection, { userWallet, iyfExtensionIx, }: IyfExtensionExecute): Promise<web3.TransactionInstruction>;
|
|
68
92
|
jupiterRouteIx({ connection, userWallet, userPda, sourceTokenAccount, destinationTokenAccount, destinationMint, platformFeeAccount, eventAuthority, remainingAccounts, data, quotedOutAmount, slippageBps, platformFeeBps, checkDestinationTokenAccount, }: JupiterRouteIx): Promise<JupiterRouteIxReturn>;
|
|
93
|
+
/**
|
|
94
|
+
* Deposit multiple user pda token to passthrough token accounts
|
|
95
|
+
*
|
|
96
|
+
* @returns DepositMultipleToken instruction
|
|
97
|
+
*/
|
|
98
|
+
depositMultipleToken({ payer, deposit }: DepositMultipleToken): Promise<web3.TransactionInstruction>;
|
|
99
|
+
/**
|
|
100
|
+
* Deposit multiple user pda token to passthrough token accountsz
|
|
101
|
+
*
|
|
102
|
+
* @returns DepositMultipleToken instruction
|
|
103
|
+
*/
|
|
104
|
+
withdrawMultipleToken({ payer, withdraw, useSta }: WithdrawMultipleToken): Promise<web3.TransactionInstruction>;
|
|
105
|
+
/**
|
|
106
|
+
* Deposit single token from user pda
|
|
107
|
+
*
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
depositTokenFromUserPda({ userWallet, mint, amount, }: DepositTokenFromUserPda): Promise<web3.TransactionInstruction>;
|
|
111
|
+
/**
|
|
112
|
+
* Withdraw single token from user pda
|
|
113
|
+
*
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
withdrawTokenFromUserPda({ userWallet, mint, useSta, }: WithdrawTokenFromUserPda): Promise<web3.TransactionInstruction>;
|
|
69
117
|
}
|
|
70
118
|
export {};
|
|
71
119
|
//# sourceMappingURL=IyfMainIxGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IyfMainIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/ixGenerator/IyfMainIxGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAA6C,sBAAsB,EAAc,uBAAuB,
|
|
1
|
+
{"version":3,"file":"IyfMainIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/ixGenerator/IyfMainIxGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAA6C,sBAAsB,EAAc,uBAAuB,EAA+C,MAAM,cAAc,CAAC;AAKnL,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,cAAc,EAAE,IAAI,CAAC,sBAAsB,CAAC;CAC7C,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;IAC5B,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IACzB,kBAAkB,EAAE,IAAI,CAAC,SAAS,CAAC;IACnC,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC;IACxC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC;IAChC,kBAAkB,EAAE,IAAI,CAAC,SAAS,CAAC;IACnC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,IAAI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EAAE,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAQpH;;;;;OAKG;IACG,mBAAmB,CACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,EACE,UAAU,EACV,cAAc,GACf,EAAE,mBAAmB,GACrB,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAqCjC,cAAc,CAAC,EACnB,UAAU,EACV,UAAU,EACV,OAAO,EACP,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,IAAI,EACJ,eAAe,EACf,WAAW,EACX,cAAc,EACd,4BAA4B,GAC7B,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAyGjD;;;;OAIG;IACG,oBAAoB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAI1G;;;;OAIG;IACG,qBAAqB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAIrH;;;;OAIG;IACG,uBAAuB,CAAC,EAC5B,UAAU,EACV,IAAI,EACJ,MAAM,GACP,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAsBjE;;;;OAIG;IACG,wBAAwB,CAAC,EAC7B,UAAU,EACV,IAAI,EACJ,MAAM,GACP,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;CAsBnE"}
|
|
@@ -214,5 +214,82 @@ class IyfMainIxGenerator {
|
|
|
214
214
|
};
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Deposit multiple user pda token to passthrough token accounts
|
|
219
|
+
*
|
|
220
|
+
* @returns DepositMultipleToken instruction
|
|
221
|
+
*/
|
|
222
|
+
depositMultipleToken(_a) {
|
|
223
|
+
return __awaiter(this, arguments, void 0, function* ({ payer, deposit }) {
|
|
224
|
+
return yield (0, hawksight_1.depositMultipleToken)({ payer, deposit });
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Deposit multiple user pda token to passthrough token accountsz
|
|
229
|
+
*
|
|
230
|
+
* @returns DepositMultipleToken instruction
|
|
231
|
+
*/
|
|
232
|
+
withdrawMultipleToken(_a) {
|
|
233
|
+
return __awaiter(this, arguments, void 0, function* ({ payer, withdraw, useSta }) {
|
|
234
|
+
return yield (0, hawksight_1.withdrawMultipleToken)({ payer, withdraw, useSta });
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Deposit single token from user pda
|
|
239
|
+
*
|
|
240
|
+
* @returns
|
|
241
|
+
*/
|
|
242
|
+
depositTokenFromUserPda(_a) {
|
|
243
|
+
return __awaiter(this, arguments, void 0, function* ({ userWallet, mint, amount, }) {
|
|
244
|
+
const farm = addresses_1.USDC_FARM;
|
|
245
|
+
const userPda = (0, functions_1.generateUserPda)(userWallet);
|
|
246
|
+
const remainingAccounts = [];
|
|
247
|
+
const userToken = (0, functions_1.generateAta)(userWallet, mint);
|
|
248
|
+
const userPdaToken = (0, functions_1.generateAta)(userPda, mint);
|
|
249
|
+
const ownerFeeToken = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, mint);
|
|
250
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
251
|
+
.depositTokenToUserPda(amount)
|
|
252
|
+
.accounts({
|
|
253
|
+
farm,
|
|
254
|
+
userPda,
|
|
255
|
+
payer: userWallet,
|
|
256
|
+
userToken,
|
|
257
|
+
userPdaToken,
|
|
258
|
+
ownerFeeToken,
|
|
259
|
+
tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
|
|
260
|
+
})
|
|
261
|
+
.instruction();
|
|
262
|
+
return ix;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Withdraw single token from user pda
|
|
267
|
+
*
|
|
268
|
+
* @returns
|
|
269
|
+
*/
|
|
270
|
+
withdrawTokenFromUserPda(_a) {
|
|
271
|
+
return __awaiter(this, arguments, void 0, function* ({ userWallet, mint, useSta, }) {
|
|
272
|
+
const farm = addresses_1.USDC_FARM;
|
|
273
|
+
const userPda = (0, functions_1.generateUserPda)(userWallet);
|
|
274
|
+
const remainingAccounts = [];
|
|
275
|
+
const userToken = (0, functions_1.generateAta)(userWallet, mint);
|
|
276
|
+
const userPdaToken = useSta ? (0, functions_1.generateUserPdaStorageAccount)(userPda, mint) : (0, functions_1.generateAta)(userPda, mint);
|
|
277
|
+
const ownerFeeToken = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, mint);
|
|
278
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
279
|
+
.withdrawTokenFromUserPda()
|
|
280
|
+
.accounts({
|
|
281
|
+
farm,
|
|
282
|
+
userPda,
|
|
283
|
+
payer: userWallet,
|
|
284
|
+
userToken,
|
|
285
|
+
userPdaToken,
|
|
286
|
+
ownerFeeToken,
|
|
287
|
+
tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
|
|
288
|
+
})
|
|
289
|
+
.remainingAccounts(remainingAccounts)
|
|
290
|
+
.instruction();
|
|
291
|
+
return ix;
|
|
292
|
+
});
|
|
293
|
+
}
|
|
217
294
|
}
|
|
218
295
|
exports.IyfMainIxGenerator = IyfMainIxGenerator;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
type CreateAssociatedTokenAccountInstruction = {
|
|
3
|
+
payer: web3.PublicKey;
|
|
4
|
+
owner: web3.PublicKey;
|
|
5
|
+
mint: web3.PublicKey;
|
|
6
|
+
tokenProgram?: web3.PublicKey;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Iyf Main IX Generator
|
|
10
|
+
*/
|
|
11
|
+
export declare class UtilIxGenerator {
|
|
12
|
+
/**
|
|
13
|
+
* Create associated token account instruction
|
|
14
|
+
*
|
|
15
|
+
* @returns Create ATA instruction
|
|
16
|
+
*/
|
|
17
|
+
createAssociatedTokenAccountInstruction({ payer, owner, mint, tokenProgram }: CreateAssociatedTokenAccountInstruction): web3.TransactionInstruction;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=UtilIxGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UtilIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/ixGenerator/UtilIxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAKxC,KAAK,uCAAuC,GAAG;IAC7C,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;CAC/B,CAAA;AAED;;GAEG;AACH,qBAAa,eAAe;IAE1B;;;;OAIG;IACH,uCAAuC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,uCAAuC;CAkBtH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UtilIxGenerator = void 0;
|
|
4
|
+
const addresses_1 = require("../addresses");
|
|
5
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
6
|
+
const functions_1 = require("../functions");
|
|
7
|
+
/**
|
|
8
|
+
* Iyf Main IX Generator
|
|
9
|
+
*/
|
|
10
|
+
class UtilIxGenerator {
|
|
11
|
+
/**
|
|
12
|
+
* Create associated token account instruction
|
|
13
|
+
*
|
|
14
|
+
* @returns Create ATA instruction
|
|
15
|
+
*/
|
|
16
|
+
createAssociatedTokenAccountInstruction({ payer, owner, mint, tokenProgram }) {
|
|
17
|
+
// Designed to allow token2022
|
|
18
|
+
if (tokenProgram === undefined) {
|
|
19
|
+
tokenProgram = addresses_1.TOKEN_PROGRAM_ID;
|
|
20
|
+
}
|
|
21
|
+
const associatedToken = (0, functions_1.generateAta)(owner, mint);
|
|
22
|
+
return (0, spl_token_1.createAssociatedTokenAccountInstruction)(payer, associatedToken, owner, mint, tokenProgram, addresses_1.ASSOCIATED_TOKEN_PROGRAM);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.UtilIxGenerator = UtilIxGenerator;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Iyf Main IX Generator
|
|
4
|
+
*/
|
|
5
|
+
export declare class HawksightPdaGenerator {
|
|
6
|
+
/**
|
|
7
|
+
* Generate UserPDA
|
|
8
|
+
*
|
|
9
|
+
* @param userWallet
|
|
10
|
+
* @param farm
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
generateUserPda(userWallet: web3.PublicKey, farm?: web3.PublicKey): web3.PublicKey;
|
|
14
|
+
/**
|
|
15
|
+
* Generate the PDA for the userPda's storage account
|
|
16
|
+
*
|
|
17
|
+
* @param userPda
|
|
18
|
+
* @param mint
|
|
19
|
+
* @returns Storage Account owned by the user pda
|
|
20
|
+
*/
|
|
21
|
+
generateUserPdaStorageAccount(userPda: web3.PublicKey, mint: web3.PublicKey): web3.PublicKey;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=HawksightPdaGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HawksightPdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/pdaGenerator/HawksightPdaGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AASxC;;GAEG;AACH,qBAAa,qBAAqB;IAEhC;;;;;;OAMG;IACH,eAAe,CACb,UAAU,EAAE,IAAI,CAAC,SAAS,EAC1B,IAAI,GAAE,IAAI,CAAC,SAEV,GACA,IAAI,CAAC,SAAS;IAQjB;;;;;;OAMG;IACH,6BAA6B,CAC3B,OAAO,EAAE,IAAI,CAAC,SAAS,EACvB,IAAI,EAAE,IAAI,CAAC,SAAS;CAQvB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.HawksightPdaGenerator = void 0;
|
|
27
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
28
|
+
const addresses_1 = require("../addresses");
|
|
29
|
+
/**
|
|
30
|
+
* Iyf Main IX Generator
|
|
31
|
+
*/
|
|
32
|
+
class HawksightPdaGenerator {
|
|
33
|
+
/**
|
|
34
|
+
* Generate UserPDA
|
|
35
|
+
*
|
|
36
|
+
* @param userWallet
|
|
37
|
+
* @param farm
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
generateUserPda(userWallet, farm = new web3.PublicKey("7jLQhREMxXjKdpwVuN6gwsWt3BNfAg9WqbepffPbi4ww")) {
|
|
41
|
+
const [pda] = web3.PublicKey.findProgramAddressSync([Buffer.from("multi-user"), farm.toBuffer(), userWallet.toBuffer()], new web3.PublicKey("FqGg2Y1FNxMiGd51Q6UETixQWkF5fB92MysbYogRJb3P"));
|
|
42
|
+
return pda;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Generate the PDA for the userPda's storage account
|
|
46
|
+
*
|
|
47
|
+
* @param userPda
|
|
48
|
+
* @param mint
|
|
49
|
+
* @returns Storage Account owned by the user pda
|
|
50
|
+
*/
|
|
51
|
+
generateUserPdaStorageAccount(userPda, mint) {
|
|
52
|
+
const [storageAccount] = web3.PublicKey.findProgramAddressSync([Buffer.from("storage-token"), mint.toBuffer(), userPda.toBuffer()], addresses_1.IYF_MAIN);
|
|
53
|
+
return storageAccount;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.HawksightPdaGenerator = HawksightPdaGenerator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeteoraPdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/pdaGenerator/MeteoraPdaGenerator.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,mBAAmB;CAE/B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Orca PDA Generator
|
|
4
|
+
*/
|
|
5
|
+
export declare class OrcaPdaGenerator {
|
|
6
|
+
/**
|
|
7
|
+
* Generate Orca Position PDA
|
|
8
|
+
*
|
|
9
|
+
* @param userWallet
|
|
10
|
+
* @param farm
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
generateOrcaPositionPDA(positionMint: web3.PublicKey): web3.PublicKey;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=OrcaPdaGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrcaPdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/pdaGenerator/OrcaPdaGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAGxC;;GAEG;AACH,qBAAa,gBAAgB;IAE3B;;;;;;OAMG;IACH,uBAAuB,CACrB,YAAY,EAAE,IAAI,CAAC,SAAS,GAC3B,IAAI,CAAC,SAAS;CAOlB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.OrcaPdaGenerator = void 0;
|
|
27
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
28
|
+
const addresses_1 = require("../addresses");
|
|
29
|
+
/**
|
|
30
|
+
* Orca PDA Generator
|
|
31
|
+
*/
|
|
32
|
+
class OrcaPdaGenerator {
|
|
33
|
+
/**
|
|
34
|
+
* Generate Orca Position PDA
|
|
35
|
+
*
|
|
36
|
+
* @param userWallet
|
|
37
|
+
* @param farm
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
generateOrcaPositionPDA(positionMint) {
|
|
41
|
+
const [pda] = web3.PublicKey.findProgramAddressSync([Buffer.from("position", "utf-8"), positionMint.toBuffer()], addresses_1.ORCA_WHIRLPOOL_PROGRAM);
|
|
42
|
+
return pda;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.OrcaPdaGenerator = OrcaPdaGenerator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RaydiumPdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/pdaGenerator/RaydiumPdaGenerator.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,mBAAmB;CAE/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UtilPdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/pdaGenerator/UtilPdaGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC;;GAEG;AACH,qBAAa,gBAAgB;IAE3B,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS;CAaxD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.UtilPdaGenerator = void 0;
|
|
27
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
28
|
+
/**
|
|
29
|
+
* Util PDA Generator
|
|
30
|
+
*/
|
|
31
|
+
class UtilPdaGenerator {
|
|
32
|
+
generateAta(owner, mint) {
|
|
33
|
+
const [pda] = web3.PublicKey.findProgramAddressSync([
|
|
34
|
+
owner.toBuffer(),
|
|
35
|
+
new web3.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA").toBuffer(),
|
|
36
|
+
mint.toBuffer(),
|
|
37
|
+
], new web3.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"));
|
|
38
|
+
return pda;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.UtilPdaGenerator = UtilPdaGenerator;
|