ts: more scaffolding

This commit is contained in:
Armani Ferrante 2022-01-10 10:56:34 -05:00
parent 520fb915fc
commit e6208bf241
No known key found for this signature in database
GPG Key ID: D597A80BCF8E12B7
2 changed files with 35 additions and 0 deletions

29
ts/src/spl/dex.ts Normal file
View File

@ -0,0 +1,29 @@
import { PublicKey } from "@solana/web3.js";
import { Program } from "../program/index.js";
import Provider from "../provider.js";
import { DexCoder } from "../coder/dex/index.js";
const DEX_PROGRAM_ID = new PublicKey(
// TODO
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
);
export function program(provider?: Provider): Program<Dex> {
return new Program<Dex>(IDL, DEX_PROGRAM_ID, provider, new DexCoder(IDL));
}
// TODO
export type Dex = {
version: "0.1.0";
name: "spl_token";
instructions: [];
accounts: [];
};
// TODO
export const IDL: Dex = {
version: "0.1.0",
name: "spl_token",
instructions: [],
accounts: [],
};

View File

@ -1,10 +1,16 @@
import { Program } from "../index.js";
import { program as tokenProgram, SplToken } from "./token.js";
import { program as dexProgram, Dex } from "./dex.js";
export { SplToken } from "./token.js";
export { Dex } from "./dex.js";
export class Spl {
public static token(): Program<SplToken> {
return tokenProgram();
}
public static dex(): Program<Dex> {
return dexProgram();
}
}