-
Notifications
You must be signed in to change notification settings - Fork 77
feat: adds a wip SDK structure #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Connection, PublicKey } from "@solana/web3.js"; | ||
import { AuctionHouseSettings } from "./settings"; | ||
import { AuctionHouseStats } from "./stats"; | ||
|
||
export class AuctionHouseClient { | ||
private connection: Connection; | ||
|
||
constructor(connection: Connection) { | ||
this.connection = connection; | ||
} | ||
|
||
loadAuctionHouse(auctionHouseKey: PublicKey): Promise<AuctionHouse> { | ||
return new AuctionHouse({}).refresh(); | ||
} | ||
|
||
createAuctionHouse(settings: AuctionHouseSettings): Promise<AuctionHouse> { | ||
return new AuctionHouse({}).refresh(); | ||
} | ||
|
||
updateAuctionHouse(auctionHouseKey: PublicKey, settings: AuctionHouseSettings): Promise<AuctionHouse> { | ||
return new AuctionHouse({}).refresh(); | ||
} | ||
} | ||
|
||
export class AuctionHouse { | ||
private settings: AuctionHouseSettings; | ||
private stats: AuctionHouseStats; | ||
constructor(settings?: AuctionHouseSettings) { | ||
this.settings = settings; | ||
} | ||
private checkInitialized() { | ||
return this.settings && this.stats; | ||
} | ||
|
||
async refresh(): Promise<AuctionHouse> { | ||
//TODO: refresh stats and settings | ||
return this; | ||
} | ||
|
||
async show() { | ||
|
||
} | ||
|
||
async bid() { | ||
|
||
} | ||
|
||
async list() { | ||
|
||
} | ||
|
||
async buy() { | ||
|
||
} | ||
|
||
async sell() { | ||
|
||
} | ||
|
||
async execute_sale() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we use camel case? |
||
|
||
} | ||
|
||
async execute_sale_with_price() { | ||
|
||
} | ||
|
||
async deposit() { | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type AuctionHouseSettings = { | ||
|
||
|
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type AuctionHouseStats = { | ||
|
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Connection } from "./Connection"; | ||
import { AuctionHouseClient } from "./auctionHouse"; | ||
|
||
export class MetaplexClient { | ||
private auctionHouseClient: AuctionHouseClient; | ||
// private metadataClient: MetadataClient; EXAMPLE OF OTHER FEATURES | ||
|
||
constructor(private connection: Connection) { } | ||
|
||
get AuctionHouse() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this have to live on the client instead of just being returned? |
||
this.auctionHouseClient = this.auctionHouseClient || new AuctionHouseClient(this.connection); | ||
return this.auctionHouseClient | ||
} | ||
|
||
// get Metadata() { | ||
// this.metadataClient = this.metadataClient || new MetadataClient(this.connection); EXAMPLE OF OTHER FEATURES | ||
// return this.metadataClient; | ||
// } | ||
|
||
} | ||
export const Metaplex = { | ||
AuctionHouse: AuctionHouseClient, | ||
// Metadata: MetadataClient, EXAMPLE OF OTHER FEATURES | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call those args or config. It's not exactly settings that are stored in a file or something.