@pbpcanada/projectdam-sdk 1.0.0

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/pda.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ /**
3
+ * Find the Config PDA
4
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
5
+ * @returns [PublicKey, number] - The PDA and bump seed
6
+ */
7
+ export declare function findConfigPDA(programId?: PublicKey): [PublicKey, number];
8
+ /**
9
+ * Find a Pool PDA
10
+ * @param owner - Pool owner's public key
11
+ * @param uuid - 6-byte UUID for the pool
12
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
13
+ * @returns [PublicKey, number] - The PDA and bump seed
14
+ */
15
+ export declare function findPoolPDA(owner: PublicKey, uuid: Buffer, programId?: PublicKey): [PublicKey, number];
16
+ /**
17
+ * Find a SOL Vault PDA for a pool
18
+ * @param pool - Pool's public key
19
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
20
+ * @returns [PublicKey, number] - The PDA and bump seed
21
+ */
22
+ export declare function findSolVaultPDA(pool: PublicKey, programId?: PublicKey): [PublicKey, number];
23
+ /**
24
+ * Find a Pool NFT PDA
25
+ * @param pool - Pool's public key
26
+ * @param nftMint - NFT mint's public key
27
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
28
+ * @returns [PublicKey, number] - The PDA and bump seed
29
+ */
30
+ export declare function findPoolNftPDA(pool: PublicKey, nftMint: PublicKey, programId?: PublicKey): [PublicKey, number];
31
+ /**
32
+ * Find a Whitelist PDA
33
+ * @param pool - Pool's public key
34
+ * @param nftMint - NFT mint's public key
35
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
36
+ * @returns [PublicKey, number] - The PDA and bump seed
37
+ */
38
+ export declare function findWhitelistPDA(pool: PublicKey, nftMint: PublicKey, programId?: PublicKey): [PublicKey, number];
39
+ /**
40
+ * Find a Season PDA
41
+ * @param month - Month (1-12)
42
+ * @param year - Year
43
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
44
+ * @returns [PublicKey, number] - The PDA and bump seed
45
+ */
46
+ export declare function findSeasonPDA(month: number, year: number, programId?: PublicKey): [PublicKey, number];
47
+ /**
48
+ * Find a Trader Volume PDA
49
+ * @param month - Month (1-12)
50
+ * @param year - Year
51
+ * @param trader - Trader's public key
52
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
53
+ * @returns [PublicKey, number] - The PDA and bump seed
54
+ */
55
+ export declare function findTraderVolumePDA(month: number, year: number, trader: PublicKey, programId?: PublicKey): [PublicKey, number];
56
+ /**
57
+ * Find a Collection Stats PDA
58
+ * @param collectionMint - Collection mint's public key
59
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
60
+ * @returns [PublicKey, number] - The PDA and bump seed
61
+ */
62
+ export declare function findCollectionStatsPDA(collectionMint: PublicKey, programId?: PublicKey): [PublicKey, number];
63
+ /**
64
+ * Find a Protocol Info PDA (for global stats)
65
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
66
+ * @returns [PublicKey, number] - The PDA and bump seed
67
+ */
68
+ export declare function findProtocolInfoPDA(programId?: PublicKey): [PublicKey, number];
69
+ /**
70
+ * Generate a random 6-byte UUID for pool creation
71
+ * @returns Buffer - 6-byte random buffer
72
+ */
73
+ export declare function generatePoolUuid(): Buffer;
74
+ /**
75
+ * Find the Metaplex metadata PDA for an NFT
76
+ * @param mint - NFT mint's public key
77
+ * @param metaplexProgramId - Metaplex program ID (optional)
78
+ * @returns [PublicKey, number] - The metadata PDA and bump seed
79
+ */
80
+ export declare function findMetadataPDA(mint: PublicKey, metaplexProgramId?: PublicKey): [PublicKey, number];
81
+ //# sourceMappingURL=pda.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pda.d.ts","sourceRoot":"","sources":["../src/pda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5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,MAAM,CAAC,CAK1F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,iBAAiB,GAAE,SAAwE,GAC1F,CAAC,SAAS,EAAE,MAAM,CAAC,CAKrB"}
package/dist/pda.js ADDED
@@ -0,0 +1,119 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { PROGRAM_ID } from './constants.js';
3
+ /**
4
+ * Find the Config PDA
5
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
6
+ * @returns [PublicKey, number] - The PDA and bump seed
7
+ */
8
+ export function findConfigPDA(programId = PROGRAM_ID) {
9
+ return PublicKey.findProgramAddressSync([Buffer.from('dam_config')], programId);
10
+ }
11
+ /**
12
+ * Find a Pool PDA
13
+ * @param owner - Pool owner's public key
14
+ * @param uuid - 6-byte UUID for the pool
15
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
16
+ * @returns [PublicKey, number] - The PDA and bump seed
17
+ */
18
+ export function findPoolPDA(owner, uuid, programId = PROGRAM_ID) {
19
+ if (uuid.length !== 6) {
20
+ throw new Error('UUID must be exactly 6 bytes');
21
+ }
22
+ return PublicKey.findProgramAddressSync([Buffer.from('pool'), owner.toBuffer(), uuid], programId);
23
+ }
24
+ /**
25
+ * Find a SOL Vault PDA for a pool
26
+ * @param pool - Pool's public key
27
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
28
+ * @returns [PublicKey, number] - The PDA and bump seed
29
+ */
30
+ export function findSolVaultPDA(pool, programId = PROGRAM_ID) {
31
+ return PublicKey.findProgramAddressSync([Buffer.from('sol_vault'), pool.toBuffer()], programId);
32
+ }
33
+ /**
34
+ * Find a Pool NFT PDA
35
+ * @param pool - Pool's public key
36
+ * @param nftMint - NFT mint's public key
37
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
38
+ * @returns [PublicKey, number] - The PDA and bump seed
39
+ */
40
+ export function findPoolNftPDA(pool, nftMint, programId = PROGRAM_ID) {
41
+ return PublicKey.findProgramAddressSync([Buffer.from('pool_nft'), pool.toBuffer(), nftMint.toBuffer()], programId);
42
+ }
43
+ /**
44
+ * Find a Whitelist PDA
45
+ * @param pool - Pool's public key
46
+ * @param nftMint - NFT mint's public key
47
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
48
+ * @returns [PublicKey, number] - The PDA and bump seed
49
+ */
50
+ export function findWhitelistPDA(pool, nftMint, programId = PROGRAM_ID) {
51
+ return PublicKey.findProgramAddressSync([Buffer.from('whitelist'), pool.toBuffer(), nftMint.toBuffer()], programId);
52
+ }
53
+ /**
54
+ * Find a Season PDA
55
+ * @param month - Month (1-12)
56
+ * @param year - Year
57
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
58
+ * @returns [PublicKey, number] - The PDA and bump seed
59
+ */
60
+ export function findSeasonPDA(month, year, programId = PROGRAM_ID) {
61
+ if (month < 1 || month > 12) {
62
+ throw new Error('Month must be between 1 and 12');
63
+ }
64
+ const monthBuffer = Buffer.from([month]);
65
+ const yearBuffer = Buffer.alloc(2);
66
+ yearBuffer.writeUInt16LE(year, 0);
67
+ return PublicKey.findProgramAddressSync([Buffer.from('season'), monthBuffer, yearBuffer], programId);
68
+ }
69
+ /**
70
+ * Find a Trader Volume PDA
71
+ * @param month - Month (1-12)
72
+ * @param year - Year
73
+ * @param trader - Trader's public key
74
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
75
+ * @returns [PublicKey, number] - The PDA and bump seed
76
+ */
77
+ export function findTraderVolumePDA(month, year, trader, programId = PROGRAM_ID) {
78
+ if (month < 1 || month > 12) {
79
+ throw new Error('Month must be between 1 and 12');
80
+ }
81
+ const monthBuffer = Buffer.from([month]);
82
+ const yearBuffer = Buffer.alloc(2);
83
+ yearBuffer.writeUInt16LE(year, 0);
84
+ return PublicKey.findProgramAddressSync([Buffer.from('trader_vol'), monthBuffer, yearBuffer, trader.toBuffer()], programId);
85
+ }
86
+ /**
87
+ * Find a Collection Stats PDA
88
+ * @param collectionMint - Collection mint's public key
89
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
90
+ * @returns [PublicKey, number] - The PDA and bump seed
91
+ */
92
+ export function findCollectionStatsPDA(collectionMint, programId = PROGRAM_ID) {
93
+ return PublicKey.findProgramAddressSync([Buffer.from('collection'), collectionMint.toBuffer()], programId);
94
+ }
95
+ /**
96
+ * Find a Protocol Info PDA (for global stats)
97
+ * @param programId - The program ID (optional, defaults to PROGRAM_ID)
98
+ * @returns [PublicKey, number] - The PDA and bump seed
99
+ */
100
+ export function findProtocolInfoPDA(programId = PROGRAM_ID) {
101
+ return PublicKey.findProgramAddressSync([Buffer.from('protocol_info')], programId);
102
+ }
103
+ /**
104
+ * Generate a random 6-byte UUID for pool creation
105
+ * @returns Buffer - 6-byte random buffer
106
+ */
107
+ export function generatePoolUuid() {
108
+ return Buffer.from(crypto.getRandomValues(new Uint8Array(6)));
109
+ }
110
+ /**
111
+ * Find the Metaplex metadata PDA for an NFT
112
+ * @param mint - NFT mint's public key
113
+ * @param metaplexProgramId - Metaplex program ID (optional)
114
+ * @returns [PublicKey, number] - The metadata PDA and bump seed
115
+ */
116
+ export function findMetadataPDA(mint, metaplexProgramId = new PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s')) {
117
+ return PublicKey.findProgramAddressSync([Buffer.from('metadata'), metaplexProgramId.toBuffer(), mint.toBuffer()], metaplexProgramId);
118
+ }
119
+ //# sourceMappingURL=pda.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pda.js","sourceRoot":"","sources":["../src/pda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,YAAuB,UAAU;IAC7D,OAAO,SAAS,CAAC,sBAAsB,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uB,UAAU;IAEjC,OAAO,SAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC,EACtD,SAAS,CACV,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAuB,UAAU;IACnE,OAAO,SAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAC9B,SAAS,CACV,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAe,EACf,oBAA+B,IAAI,SAAS,CAAC,6CAA6C,CAAC;IAE3F,OAAO,SAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EACxE,iBAAiB,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,152 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ /**
3
+ * Curve types for pricing
4
+ */
5
+ export declare enum CurveType {
6
+ Fixed = 0,
7
+ Linear = 1,
8
+ Exponential = 2
9
+ }
10
+ /**
11
+ * Pool types
12
+ */
13
+ export declare enum PoolType {
14
+ /** NFT pools - buy from pool */
15
+ Nft = 0,
16
+ /** Token pools - sell to pool */
17
+ Token = 1,
18
+ /** Trade pools - both buy and sell */
19
+ Trade = 2
20
+ }
21
+ /**
22
+ * Curve configuration
23
+ */
24
+ export interface CurveConfig {
25
+ type: CurveType;
26
+ delta?: bigint | number;
27
+ }
28
+ /**
29
+ * Protocol configuration account
30
+ */
31
+ export interface Config {
32
+ bump: number;
33
+ authority: PublicKey;
34
+ protocolFeeBps: number;
35
+ buybackBps: number;
36
+ feeTreasury: PublicKey;
37
+ pbpBuybackWallet: PublicKey;
38
+ totalPools: bigint;
39
+ totalTrades: bigint;
40
+ feeBuffer: bigint;
41
+ paused: boolean;
42
+ }
43
+ /**
44
+ * Pool account data
45
+ */
46
+ export interface Pool {
47
+ bump: number;
48
+ owner: PublicKey;
49
+ uuid: Buffer;
50
+ collection: PublicKey;
51
+ curveType: CurveConfig;
52
+ spotPrice: bigint;
53
+ spreadBps: number;
54
+ nftCount: number;
55
+ solBalance: bigint;
56
+ buyCount: bigint;
57
+ sellCount: bigint;
58
+ poolType: PoolType;
59
+ isActive: boolean;
60
+ createdAt: bigint;
61
+ }
62
+ /**
63
+ * Pool NFT tracking account
64
+ */
65
+ export interface PoolNft {
66
+ bump: number;
67
+ pool: PublicKey;
68
+ nftMint: PublicKey;
69
+ depositor: PublicKey;
70
+ depositedAt: bigint;
71
+ priceAtDeposit: bigint;
72
+ }
73
+ /**
74
+ * Season tracking (for volume competitions)
75
+ */
76
+ export interface Season {
77
+ month: number;
78
+ year: number;
79
+ totalVolume: bigint;
80
+ totalTrades: bigint;
81
+ topTraders: PublicKey[];
82
+ isActive: boolean;
83
+ }
84
+ /**
85
+ * Trader volume tracking
86
+ */
87
+ export interface TraderVolume {
88
+ trader: PublicKey;
89
+ month: number;
90
+ year: number;
91
+ totalVolume: bigint;
92
+ tradeCount: bigint;
93
+ lastTradeAt: bigint;
94
+ }
95
+ /**
96
+ * Collection statistics
97
+ */
98
+ export interface CollectionStats {
99
+ collection: PublicKey;
100
+ totalVolume: bigint;
101
+ totalTrades: bigint;
102
+ floorPrice: bigint;
103
+ averagePrice: bigint;
104
+ poolCount: number;
105
+ lastUpdateAt: bigint;
106
+ }
107
+ /**
108
+ * Trade event
109
+ */
110
+ export interface TradeEvent {
111
+ pool: PublicKey;
112
+ buyer: PublicKey;
113
+ seller: PublicKey;
114
+ nftMint: PublicKey;
115
+ price: bigint;
116
+ protocolFee: bigint;
117
+ creatorRoyalty: bigint;
118
+ isBuy: boolean;
119
+ }
120
+ /**
121
+ * Pool created event
122
+ */
123
+ export interface PoolCreatedEvent {
124
+ pool: PublicKey;
125
+ owner: PublicKey;
126
+ collection: PublicKey;
127
+ curveType: CurveConfig;
128
+ spotPrice: bigint;
129
+ poolType: PoolType;
130
+ }
131
+ /**
132
+ * Options for creating a pool
133
+ */
134
+ export interface CreatePoolOptions {
135
+ uuid: Buffer;
136
+ curveType: CurveConfig;
137
+ spotPrice: bigint;
138
+ spreadBps: number;
139
+ poolType: PoolType;
140
+ }
141
+ /**
142
+ * Options for trading
143
+ */
144
+ export interface BuyOptions {
145
+ maxPrice: bigint;
146
+ royaltyBps?: number;
147
+ }
148
+ export interface SellOptions {
149
+ minPrice: bigint;
150
+ royaltyBps?: number;
151
+ }
152
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,oBAAY,SAAS;IACnB,KAAK,IAAI;IACT,MAAM,IAAI;IACV,WAAW,IAAI;CAChB;AAED;;GAEG;AACH,oBAAY,QAAQ;IAClB,gCAAgC;IAChC,GAAG,IAAI;IACP,iCAAiC;IACjC,KAAK,IAAI;IACT,sCAAsC;IACtC,KAAK,IAAI;CACV;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,SAAS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/dist/types.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Curve types for pricing
3
+ */
4
+ export var CurveType;
5
+ (function (CurveType) {
6
+ CurveType[CurveType["Fixed"] = 0] = "Fixed";
7
+ CurveType[CurveType["Linear"] = 1] = "Linear";
8
+ CurveType[CurveType["Exponential"] = 2] = "Exponential";
9
+ })(CurveType || (CurveType = {}));
10
+ /**
11
+ * Pool types
12
+ */
13
+ export var PoolType;
14
+ (function (PoolType) {
15
+ /** NFT pools - buy from pool */
16
+ PoolType[PoolType["Nft"] = 0] = "Nft";
17
+ /** Token pools - sell to pool */
18
+ PoolType[PoolType["Token"] = 1] = "Token";
19
+ /** Trade pools - both buy and sell */
20
+ PoolType[PoolType["Trade"] = 2] = "Trade";
21
+ })(PoolType || (PoolType = {}));
22
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,2CAAS,CAAA;IACT,6CAAU,CAAA;IACV,uDAAe,CAAA;AACjB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,gCAAgC;IAChC,qCAAO,CAAA;IACP,iCAAiC;IACjC,yCAAS,CAAA;IACT,sCAAsC;IACtC,yCAAS,CAAA;AACX,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@pbpcanada/projectdam-sdk",
3
+ "version": "1.0.0",
4
+ "description": "TypeScript SDK for ProjectDAM - Agent-operated NFT AMM on Solana",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "prepare": "npm run build",
21
+ "test": "echo \"Error: no test specified\" && exit 1"
22
+ },
23
+ "keywords": [
24
+ "solana",
25
+ "nft",
26
+ "amm",
27
+ "defi",
28
+ "projectdam",
29
+ "typescript",
30
+ "sdk"
31
+ ],
32
+ "author": "PBP Canada",
33
+ "license": "MIT",
34
+ "peerDependencies": {
35
+ "@coral-xyz/anchor": "^0.29.0",
36
+ "@solana/web3.js": "^1.87.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20.19.33",
40
+ "typescript": "^5.9.3"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/PbPCanada/projectdam-sdk.git"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ }
49
+ }