solforge 0.2.9 → 0.2.10
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/package.json
CHANGED
|
@@ -12,6 +12,11 @@ import {
|
|
|
12
12
|
} from "@solana/spl-token";
|
|
13
13
|
import { u8 } from "@solana/buffer-layout";
|
|
14
14
|
import { PublicKey as PK } from "@solana/web3.js";
|
|
15
|
+
import {
|
|
16
|
+
TOKEN_PROGRAM_ID as TOKEN_PROGRAM_V1,
|
|
17
|
+
TOKEN_2022_PROGRAM_ID as TOKEN_PROGRAM_2022,
|
|
18
|
+
getAssociatedTokenAddressSync,
|
|
19
|
+
} from "@solana/spl-token";
|
|
15
20
|
|
|
16
21
|
// Keep shape compatible with instruction-parser
|
|
17
22
|
export type ParsedInstruction =
|
|
@@ -219,10 +224,30 @@ export function tryParseSplToken(
|
|
|
219
224
|
return undefined;
|
|
220
225
|
}
|
|
221
226
|
})();
|
|
227
|
+
const ownerStr = asBase58(a.data.owner);
|
|
228
|
+
const mintStr = asBase58(a.keys.mint?.pubkey) || hintMint;
|
|
229
|
+
let accountStr = asBase58(a.keys.account?.pubkey);
|
|
230
|
+
try {
|
|
231
|
+
if (!accountStr && ownerStr && mintStr) {
|
|
232
|
+
const ownerPk = new PK(ownerStr);
|
|
233
|
+
const mintPk = new PK(mintStr);
|
|
234
|
+
const programId =
|
|
235
|
+
programIdStr === TOKEN_PROGRAM_2022.toBase58()
|
|
236
|
+
? TOKEN_PROGRAM_2022
|
|
237
|
+
: TOKEN_PROGRAM_V1;
|
|
238
|
+
const ata = getAssociatedTokenAddressSync(
|
|
239
|
+
mintPk,
|
|
240
|
+
ownerPk,
|
|
241
|
+
true,
|
|
242
|
+
programId,
|
|
243
|
+
);
|
|
244
|
+
accountStr = ata.toBase58();
|
|
245
|
+
}
|
|
246
|
+
} catch {}
|
|
222
247
|
return ok(programIdStr, "initializeAccount3", {
|
|
223
|
-
account:
|
|
224
|
-
mint:
|
|
225
|
-
owner:
|
|
248
|
+
account: accountStr,
|
|
249
|
+
mint: mintStr,
|
|
250
|
+
owner: ownerStr,
|
|
226
251
|
});
|
|
227
252
|
}
|
|
228
253
|
// InitializeImmutableOwner
|