@hawksightco/hawk-sdk 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/classes/HawkAPI.d.ts +8 -0
- package/dist/src/classes/HawkAPI.d.ts.map +1 -1
- package/dist/src/classes/HawkAPI.js +10 -0
- package/dist/src/classes/account-cache/AccountCache.d.ts +8 -1
- package/dist/src/classes/account-cache/AccountCache.d.ts.map +1 -1
- package/dist/src/classes/account-cache/AccountCache.js +51 -9
- package/dist/src/classes/account-cache/TokenCache.d.ts +33 -0
- package/dist/src/classes/account-cache/TokenCache.d.ts.map +1 -0
- package/dist/src/classes/account-cache/TokenCache.js +47 -0
- package/dist/src/hsToMeteora.d.ts.map +1 -1
- package/dist/src/hsToMeteora.js +195 -87
- package/dist/src/idl/meteora-idl.d.ts +2253 -133
- package/dist/src/idl/meteora-idl.d.ts.map +1 -1
- package/dist/src/idl/meteora-idl.js +2253 -133
- package/dist/src/meteora.js +2 -2
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ import { SimplePdaGenerator } from './SimplePdaGenerator';
|
|
|
17
17
|
import { RaydiumSDK } from "./RaydiumSDK";
|
|
18
18
|
import { Anchor } from "../anchor";
|
|
19
19
|
import { MintCache } from "./account-cache/MintCache";
|
|
20
|
+
import { TokenCache } from "./account-cache/TokenCache";
|
|
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
|
|
@@ -73,6 +74,13 @@ export declare class HawkAPI {
|
|
|
73
74
|
* @returns The MintCache instance
|
|
74
75
|
*/
|
|
75
76
|
mintCache(connection: web3.Connection): MintCache;
|
|
77
|
+
/**
|
|
78
|
+
* Token cache
|
|
79
|
+
*
|
|
80
|
+
* @param connection The Solana connection
|
|
81
|
+
* @returns The TokenCache instance
|
|
82
|
+
*/
|
|
83
|
+
tokenCache(connection: web3.Connection): TokenCache;
|
|
76
84
|
/**
|
|
77
85
|
* Override transaction generator
|
|
78
86
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HawkAPI.d.ts","sourceRoot":"","sources":["../../../src/classes/HawkAPI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,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,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9G,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"HawkAPI.d.ts","sourceRoot":"","sources":["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;IAWzJ;;;;OAIG;IACH,YAAY,CAAC,EAAC,oBAAoB,EAAE,YAAY,EAAE,KAAK,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;IAIrB;;;;OAIG;IACG,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAQnE"}
|
|
@@ -30,6 +30,7 @@ const CombineTransactions_1 = require("./CombineTransactions");
|
|
|
30
30
|
const RaydiumSDK_1 = require("./RaydiumSDK");
|
|
31
31
|
const anchor_1 = require("../anchor");
|
|
32
32
|
const MintCache_1 = require("./account-cache/MintCache");
|
|
33
|
+
const TokenCache_1 = require("./account-cache/TokenCache");
|
|
33
34
|
/**
|
|
34
35
|
* HawkAPI is a central gateway class that aggregates access to various functional modules
|
|
35
36
|
* for interacting with HawkSight's blockchain APIs. This class initializes and exposes modules
|
|
@@ -92,6 +93,15 @@ class HawkAPI {
|
|
|
92
93
|
mintCache(connection) {
|
|
93
94
|
return MintCache_1.MintCache.instance(connection);
|
|
94
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Token cache
|
|
98
|
+
*
|
|
99
|
+
* @param connection The Solana connection
|
|
100
|
+
* @returns The TokenCache instance
|
|
101
|
+
*/
|
|
102
|
+
tokenCache(connection) {
|
|
103
|
+
return TokenCache_1.TokenCache.instance(connection);
|
|
104
|
+
}
|
|
95
105
|
/**
|
|
96
106
|
* Override transaction generator
|
|
97
107
|
*
|
|
@@ -10,7 +10,7 @@ export declare abstract class AccountCache {
|
|
|
10
10
|
/**
|
|
11
11
|
* Cache of accounts.
|
|
12
12
|
*/
|
|
13
|
-
protected accounts: _AccountCache;
|
|
13
|
+
protected static accounts: _AccountCache;
|
|
14
14
|
/**
|
|
15
15
|
* Promise that resolves when the accounts are fetched.
|
|
16
16
|
* This is used to wait for the accounts to be fetched before using them.
|
|
@@ -30,6 +30,13 @@ export declare abstract class AccountCache {
|
|
|
30
30
|
* Whether the account query should require the account to exist.
|
|
31
31
|
*/
|
|
32
32
|
protected abstract requireToExist(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get account info from cache
|
|
35
|
+
*
|
|
36
|
+
* @param key
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
static get(key: web3.PublicKey): AccountInfoInternal | undefined;
|
|
33
40
|
/**
|
|
34
41
|
* Mark accounts to be refetched
|
|
35
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountCache.d.ts","sourceRoot":"","sources":["../../../../src/classes/account-cache/AccountCache.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC,CAAA;AAED,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEzD,8BAAsB,YAAY;IAmB9B,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU;IAjBvC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAM;
|
|
1
|
+
{"version":3,"file":"AccountCache.d.ts","sourceRoot":"","sources":["../../../../src/classes/account-cache/AccountCache.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC,CAAA;AAED,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEzD,8BAAsB,YAAY;IAmB9B,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU;IAjBvC;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAM;IAE9C;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAQ;IAE/C;;;;OAIG;gBAES,UAAU,EAAE,IAAI,CAAC,UAAU;IAGvC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,yBAAyB,IAAI,IAAI,CAAC,SAAS,EAAE;IAEhE;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,OAAO;IAE5C;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,GAAG,mBAAmB,GAAG,SAAS;IAIhE;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI;IASxC;;;;;;OAMG;IACH,8BAA8B,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,UAAU,GAAE,IAAI,CAAC,UAAwB,GAAG,IAAI;IA2CpG,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;CAM9C"}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,6 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.AccountCache = void 0;
|
|
36
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
13
37
|
class AccountCache {
|
|
14
38
|
/**
|
|
15
39
|
* Instantiate the AccountCache class
|
|
@@ -18,22 +42,29 @@ class AccountCache {
|
|
|
18
42
|
*/
|
|
19
43
|
constructor(connection) {
|
|
20
44
|
this.connection = connection;
|
|
21
|
-
/**
|
|
22
|
-
* Cache of accounts.
|
|
23
|
-
*/
|
|
24
|
-
this.accounts = {};
|
|
25
45
|
/**
|
|
26
46
|
* Promise that resolves when the accounts are fetched.
|
|
27
47
|
* This is used to wait for the accounts to be fetched before using them.
|
|
28
48
|
*/
|
|
29
49
|
this.pending = null;
|
|
30
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Get account info from cache
|
|
53
|
+
*
|
|
54
|
+
* @param key
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
static get(key) {
|
|
58
|
+
return AccountCache.accounts[key.toString()];
|
|
59
|
+
}
|
|
31
60
|
/**
|
|
32
61
|
* Mark accounts to be refetched
|
|
33
62
|
*/
|
|
34
63
|
refetch(pubkeys) {
|
|
35
64
|
for (const pubkey of pubkeys) {
|
|
36
|
-
|
|
65
|
+
if (!!AccountCache.accounts[pubkey.toString()]) {
|
|
66
|
+
AccountCache.accounts[pubkey.toString()].refetch = true;
|
|
67
|
+
}
|
|
37
68
|
}
|
|
38
69
|
return this;
|
|
39
70
|
}
|
|
@@ -47,7 +78,7 @@ class AccountCache {
|
|
|
47
78
|
getBatchedMultipleAccountsInfo(pubkeys, commitment = "confirmed") {
|
|
48
79
|
// Check first if account is already fetched. Skips accounts that are marked to be refetched.
|
|
49
80
|
const pubkeysToFetch = pubkeys.filter(pubkey => {
|
|
50
|
-
const cache =
|
|
81
|
+
const cache = AccountCache.accounts[pubkey.toString()];
|
|
51
82
|
if (cache) {
|
|
52
83
|
return cache.refetch;
|
|
53
84
|
}
|
|
@@ -66,10 +97,17 @@ class AccountCache {
|
|
|
66
97
|
if (info !== null) {
|
|
67
98
|
// Throw error if account fetching requires program ownership
|
|
68
99
|
const mustBeOwnedByEither = this.mustOwnedByEitherPrograms();
|
|
69
|
-
|
|
100
|
+
const requiredToExist = this.requireToExist();
|
|
101
|
+
const doesNotExist = info.owner.equals(web3.SystemProgram.programId) && info.data.length === 0;
|
|
102
|
+
if (doesNotExist && !requiredToExist) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
else if (mustBeOwnedByEither.length > 0 && !mustBeOwnedByEither.some(program => info.owner.equals(program))) {
|
|
70
106
|
throw new Error(`Account ${pubkey.toString()} is not owned by any of the programs ${mustBeOwnedByEither.map(program => program.toString()).join(", ")}`);
|
|
71
107
|
}
|
|
72
|
-
|
|
108
|
+
else {
|
|
109
|
+
AccountCache.accounts[pubkey.toString()] = { refetch: false, info };
|
|
110
|
+
}
|
|
73
111
|
}
|
|
74
112
|
else if (this.requireToExist()) {
|
|
75
113
|
throw new Error(`Account ${pubkey.toString()} does not exist`);
|
|
@@ -84,8 +122,12 @@ class AccountCache {
|
|
|
84
122
|
if (this.pending) {
|
|
85
123
|
yield this.pending;
|
|
86
124
|
}
|
|
87
|
-
return
|
|
125
|
+
return AccountCache.accounts;
|
|
88
126
|
});
|
|
89
127
|
}
|
|
90
128
|
}
|
|
91
129
|
exports.AccountCache = AccountCache;
|
|
130
|
+
/**
|
|
131
|
+
* Cache of accounts.
|
|
132
|
+
*/
|
|
133
|
+
AccountCache.accounts = {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
import { AccountCache } from "./AccountCache";
|
|
3
|
+
/**
|
|
4
|
+
* Singleton instance of AccountCache for mint accounts.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TokenCache extends AccountCache {
|
|
7
|
+
/**
|
|
8
|
+
* Singleton instance of TokenCache
|
|
9
|
+
*/
|
|
10
|
+
private static _instance;
|
|
11
|
+
/**
|
|
12
|
+
* Instantiate the TokenCache class
|
|
13
|
+
*
|
|
14
|
+
* @param connection The Solana connection
|
|
15
|
+
*/
|
|
16
|
+
private constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Get the singleton instance of TokenCache
|
|
19
|
+
*
|
|
20
|
+
* @param connection The Solana connection
|
|
21
|
+
* @returns The TokenCache instance
|
|
22
|
+
*/
|
|
23
|
+
static instance(connection: web3.Connection): TokenCache;
|
|
24
|
+
/**
|
|
25
|
+
* Criteria of accounts to be fetched must be only owned by the given programs
|
|
26
|
+
*/
|
|
27
|
+
protected mustOwnedByEitherPrograms(): web3.PublicKey[];
|
|
28
|
+
/**
|
|
29
|
+
* Whether the account query should require the account to exist.
|
|
30
|
+
*/
|
|
31
|
+
protected requireToExist(): boolean;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=TokenCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenCache.d.ts","sourceRoot":"","sources":["../../../../src/classes/account-cache/TokenCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;GAEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAE1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS,CAA2B;IAEnD;;;;OAIG;IACH,OAAO;IAIP;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,GAAG,UAAU;IAOxD;;OAEG;IACH,SAAS,CAAC,yBAAyB,IAAI,IAAI,CAAC,SAAS,EAAE;IAIvD;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,OAAO;CAGpC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenCache = void 0;
|
|
4
|
+
const AccountCache_1 = require("./AccountCache");
|
|
5
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
6
|
+
/**
|
|
7
|
+
* Singleton instance of AccountCache for mint accounts.
|
|
8
|
+
*/
|
|
9
|
+
class TokenCache extends AccountCache_1.AccountCache {
|
|
10
|
+
/**
|
|
11
|
+
* Instantiate the TokenCache class
|
|
12
|
+
*
|
|
13
|
+
* @param connection The Solana connection
|
|
14
|
+
*/
|
|
15
|
+
constructor(connection) {
|
|
16
|
+
super(connection);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the singleton instance of TokenCache
|
|
20
|
+
*
|
|
21
|
+
* @param connection The Solana connection
|
|
22
|
+
* @returns The TokenCache instance
|
|
23
|
+
*/
|
|
24
|
+
static instance(connection) {
|
|
25
|
+
if (!TokenCache._instance) {
|
|
26
|
+
TokenCache._instance = new TokenCache(connection);
|
|
27
|
+
}
|
|
28
|
+
return TokenCache._instance;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Criteria of accounts to be fetched must be only owned by the given programs
|
|
32
|
+
*/
|
|
33
|
+
mustOwnedByEitherPrograms() {
|
|
34
|
+
return [spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.TOKEN_2022_PROGRAM_ID];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether the account query should require the account to exist.
|
|
38
|
+
*/
|
|
39
|
+
requireToExist() {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.TokenCache = TokenCache;
|
|
44
|
+
/**
|
|
45
|
+
* Singleton instance of TokenCache
|
|
46
|
+
*/
|
|
47
|
+
TokenCache._instance = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../../src/hsToMeteora.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAA6B,wBAAwB,EAAa,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../../src/hsToMeteora.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAA6B,wBAAwB,EAAa,MAAM,SAAS,CAAC;AAiBzF;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUzI;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUtJ;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAU/I"}
|