privacycash 1.1.7 → 1.1.9
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/deposit.d.ts +2 -1
- package/dist/deposit.js +9 -6
- package/dist/depositSPL.d.ts +2 -1
- package/dist/depositSPL.js +10 -7
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +8 -2
- package/package.json +1 -1
- package/src/deposit.ts +11 -6
- package/src/depositSPL.ts +11 -7
- package/src/utils/constants.ts +8 -2
package/dist/deposit.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ type DepositParams = {
|
|
|
10
10
|
keyBasePath: string;
|
|
11
11
|
lightWasm: hasher.LightWasm;
|
|
12
12
|
referrer?: string;
|
|
13
|
+
signer?: PublicKey;
|
|
13
14
|
transactionSigner: (tx: VersionedTransaction) => Promise<VersionedTransaction>;
|
|
14
15
|
};
|
|
15
|
-
export declare function deposit({ lightWasm, storage, keyBasePath, publicKey, connection, amount_in_lamports, encryptionService, transactionSigner, referrer }: DepositParams): Promise<{
|
|
16
|
+
export declare function deposit({ lightWasm, storage, keyBasePath, publicKey, connection, amount_in_lamports, encryptionService, transactionSigner, referrer, signer }: DepositParams): Promise<{
|
|
16
17
|
tx: string;
|
|
17
18
|
}>;
|
|
18
19
|
export {};
|
package/dist/deposit.js
CHANGED
|
@@ -44,20 +44,23 @@ async function relayDepositToIndexer(signedTransaction, publicKey, referrer) {
|
|
|
44
44
|
throw error;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
export async function deposit({ lightWasm, storage, keyBasePath, publicKey, connection, amount_in_lamports, encryptionService, transactionSigner, referrer }) {
|
|
47
|
+
export async function deposit({ lightWasm, storage, keyBasePath, publicKey, connection, amount_in_lamports, encryptionService, transactionSigner, referrer, signer }) {
|
|
48
48
|
// check limit
|
|
49
49
|
let limitAmount = await checkDepositLimit(connection);
|
|
50
50
|
if (limitAmount && amount_in_lamports > limitAmount * LAMPORTS_PER_SOL) {
|
|
51
51
|
throw new Error(`Don't deposit more than ${limitAmount} SOL`);
|
|
52
52
|
}
|
|
53
|
+
if (!signer) {
|
|
54
|
+
signer = publicKey;
|
|
55
|
+
}
|
|
53
56
|
// const amount_in_lamports = amount_in_sol * LAMPORTS_PER_SOL
|
|
54
57
|
const fee_amount_in_lamports = 0;
|
|
55
58
|
logger.debug('Encryption key generated from user keypair');
|
|
56
|
-
logger.debug(`User wallet: ${
|
|
59
|
+
logger.debug(`User wallet: ${signer.toString()}`);
|
|
57
60
|
logger.debug(`Deposit amount: ${amount_in_lamports} lamports (${amount_in_lamports / LAMPORTS_PER_SOL} SOL)`);
|
|
58
61
|
logger.debug(`Calculated fee: ${fee_amount_in_lamports} lamports (${fee_amount_in_lamports / LAMPORTS_PER_SOL} SOL)`);
|
|
59
62
|
// Check wallet balance
|
|
60
|
-
const balance = await connection.getBalance(
|
|
63
|
+
const balance = await connection.getBalance(signer);
|
|
61
64
|
logger.debug(`Wallet balance: ${balance / 1e9} SOL`);
|
|
62
65
|
if (balance < amount_in_lamports + fee_amount_in_lamports) {
|
|
63
66
|
throw new Error(`Insufficient balance: ${balance / 1e9} SOL. Need at least ${(amount_in_lamports + fee_amount_in_lamports) / LAMPORTS_PER_SOL} SOL.`);
|
|
@@ -303,7 +306,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
303
306
|
// fee recipient
|
|
304
307
|
{ pubkey: FEE_RECIPIENT, isSigner: false, isWritable: true },
|
|
305
308
|
// signer
|
|
306
|
-
{ pubkey:
|
|
309
|
+
{ pubkey: signer, isSigner: true, isWritable: true },
|
|
307
310
|
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
308
311
|
],
|
|
309
312
|
programId: PROGRAM_ID,
|
|
@@ -316,7 +319,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
316
319
|
// Create versioned transaction with Address Lookup Table
|
|
317
320
|
const recentBlockhash = await connection.getLatestBlockhash();
|
|
318
321
|
const messageV0 = new TransactionMessage({
|
|
319
|
-
payerKey:
|
|
322
|
+
payerKey: signer, // User pays for their own deposit
|
|
320
323
|
recentBlockhash: recentBlockhash.blockhash,
|
|
321
324
|
instructions: [modifyComputeUnits, depositInstruction],
|
|
322
325
|
}).compileToV0Message([lookupTableAccount.value]);
|
|
@@ -329,7 +332,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
329
332
|
logger.debug('Prepared signed transaction for relay to indexer backend');
|
|
330
333
|
// Relay the pre-signed transaction to indexer backend
|
|
331
334
|
logger.info('submitting transaction to relayer...');
|
|
332
|
-
const signature = await relayDepositToIndexer(serializedTransaction,
|
|
335
|
+
const signature = await relayDepositToIndexer(serializedTransaction, signer, referrer);
|
|
333
336
|
logger.debug('Transaction signature:', signature);
|
|
334
337
|
logger.debug(`Transaction link: https://explorer.solana.com/tx/${signature}`);
|
|
335
338
|
logger.info('Waiting for transaction confirmation...');
|
package/dist/depositSPL.d.ts
CHANGED
|
@@ -12,9 +12,10 @@ type DepositParams = {
|
|
|
12
12
|
keyBasePath: string;
|
|
13
13
|
lightWasm: hasher.LightWasm;
|
|
14
14
|
referrer?: string;
|
|
15
|
+
signer?: PublicKey;
|
|
15
16
|
transactionSigner: (tx: VersionedTransaction) => Promise<VersionedTransaction>;
|
|
16
17
|
};
|
|
17
|
-
export declare function depositSPL({ lightWasm, storage, keyBasePath, publicKey, connection, base_units, amount, encryptionService, transactionSigner, referrer, mintAddress }: DepositParams): Promise<{
|
|
18
|
+
export declare function depositSPL({ lightWasm, storage, keyBasePath, publicKey, connection, base_units, amount, encryptionService, transactionSigner, referrer, mintAddress, signer }: DepositParams): Promise<{
|
|
18
19
|
tx: string;
|
|
19
20
|
}>;
|
|
20
21
|
export {};
|
package/dist/depositSPL.js
CHANGED
|
@@ -53,7 +53,7 @@ async function relayDepositToIndexer({ signedTransaction, publicKey, referrer, m
|
|
|
53
53
|
throw error;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, connection, base_units, amount, encryptionService, transactionSigner, referrer, mintAddress }) {
|
|
56
|
+
export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, connection, base_units, amount, encryptionService, transactionSigner, referrer, mintAddress, signer }) {
|
|
57
57
|
if (typeof mintAddress == 'string') {
|
|
58
58
|
mintAddress = new PublicKey(mintAddress);
|
|
59
59
|
}
|
|
@@ -67,12 +67,15 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
67
67
|
if (!base_units) {
|
|
68
68
|
throw new Error('You must input at least one of "base_units" or "amount"');
|
|
69
69
|
}
|
|
70
|
+
if (!signer) {
|
|
71
|
+
signer = publicKey;
|
|
72
|
+
}
|
|
70
73
|
// let mintInfo = await getMint(connection, token.pubkey)
|
|
71
74
|
// let units_per_token = 10 ** mintInfo.decimals
|
|
72
75
|
let recipient = new PublicKey('AWexibGxNFKTa1b5R5MN4PJr9HWnWRwf8EW9g8cLx3dM');
|
|
73
76
|
let recipient_ata = getAssociatedTokenAddressSync(token.pubkey, recipient, true);
|
|
74
77
|
let feeRecipientTokenAccount = getAssociatedTokenAddressSync(token.pubkey, FEE_RECIPIENT, true);
|
|
75
|
-
let signerTokenAccount = getAssociatedTokenAddressSync(token.pubkey,
|
|
78
|
+
let signerTokenAccount = getAssociatedTokenAddressSync(token.pubkey, signer);
|
|
76
79
|
// Derive tree account PDA with mint address for SPL
|
|
77
80
|
const [treeAccount] = PublicKey.findProgramAddressSync([Buffer.from('merkle_tree'), token.pubkey.toBuffer()], PROGRAM_ID);
|
|
78
81
|
let limitAmount = await checkDepositLimit(connection, treeAccount, token);
|
|
@@ -82,7 +85,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
82
85
|
// const base_units = amount_in_sol * units_per_token
|
|
83
86
|
const fee_base_units = 0;
|
|
84
87
|
logger.debug('Encryption key generated from user keypair');
|
|
85
|
-
logger.debug(`User wallet: ${
|
|
88
|
+
logger.debug(`User wallet: ${signer.toString()}`);
|
|
86
89
|
logger.debug(`Deposit amount: ${base_units} base_units (${base_units / token.units_per_token} ${token.name.toUpperCase()})`);
|
|
87
90
|
logger.debug(`Calculated fee: ${fee_base_units} base_units (${fee_base_units / token.units_per_token} ${token.name.toUpperCase()})`);
|
|
88
91
|
// Check SPL balance
|
|
@@ -95,7 +98,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
95
98
|
throw new Error(`Insufficient balance. Need at least ${(base_units + fee_base_units) / token.units_per_token} ${token.name.toUpperCase()}.`);
|
|
96
99
|
}
|
|
97
100
|
// Check SOL balance
|
|
98
|
-
const solBalance = await connection.getBalance(
|
|
101
|
+
const solBalance = await connection.getBalance(signer);
|
|
99
102
|
logger.debug(`SOL Wallet balance: ${solBalance / 1e9} SOL`);
|
|
100
103
|
if (solBalance / 1e9 < 0.002) {
|
|
101
104
|
throw new Error(`Need at least 0.002 SOL for Solana fees.`);
|
|
@@ -339,7 +342,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
339
342
|
{ pubkey: nullifier3PDA, isSigner: false, isWritable: false },
|
|
340
343
|
{ pubkey: globalConfigAccount, isSigner: false, isWritable: false },
|
|
341
344
|
// signer
|
|
342
|
-
{ pubkey:
|
|
345
|
+
{ pubkey: signer, isSigner: true, isWritable: true },
|
|
343
346
|
// SPL token mint
|
|
344
347
|
{ pubkey: token.pubkey, isSigner: false, isWritable: false },
|
|
345
348
|
// signer's token account
|
|
@@ -369,7 +372,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
369
372
|
// Create versioned transaction with Address Lookup Table
|
|
370
373
|
const recentBlockhash = await connection.getLatestBlockhash();
|
|
371
374
|
const messageV0 = new TransactionMessage({
|
|
372
|
-
payerKey:
|
|
375
|
+
payerKey: signer, // User pays for their own deposit
|
|
373
376
|
recentBlockhash: recentBlockhash.blockhash,
|
|
374
377
|
instructions: [modifyComputeUnits, depositInstruction],
|
|
375
378
|
}).compileToV0Message([lookupTableAccount.value]);
|
|
@@ -384,7 +387,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
384
387
|
logger.info('submitting transaction to relayer...');
|
|
385
388
|
const signature = await relayDepositToIndexer({
|
|
386
389
|
mintAddress: token.pubkey.toString(),
|
|
387
|
-
publicKey,
|
|
390
|
+
publicKey: signer,
|
|
388
391
|
signedTransaction: serializedTransaction,
|
|
389
392
|
referrer
|
|
390
393
|
});
|
|
@@ -13,9 +13,9 @@ export declare const SIGN_MESSAGE = "Privacy Money account sign in";
|
|
|
13
13
|
export declare const LSK_FETCH_OFFSET = "fetch_offset";
|
|
14
14
|
export declare const LSK_ENCRYPTED_OUTPUTS = "encrypted_outputs";
|
|
15
15
|
export declare const USDC_MINT: PublicKey;
|
|
16
|
-
declare const tokenList: readonly ["sol", "usdc", "usdt", "zec", "ore"];
|
|
16
|
+
declare const tokenList: readonly ["sol", "usdc", "usdt", "zec", "ore", "store"];
|
|
17
17
|
export type TokenList = typeof tokenList[number];
|
|
18
|
-
declare const splList: readonly ["usdc", "usdt", "zec", "ore"];
|
|
18
|
+
declare const splList: readonly ["usdc", "usdt", "zec", "ore", "store"];
|
|
19
19
|
export type SplList = typeof splList[number];
|
|
20
20
|
export type Token = {
|
|
21
21
|
name: TokenList;
|
package/dist/utils/constants.js
CHANGED
|
@@ -14,8 +14,8 @@ export const SIGN_MESSAGE = `Privacy Money account sign in`;
|
|
|
14
14
|
export const LSK_FETCH_OFFSET = 'fetch_offset';
|
|
15
15
|
export const LSK_ENCRYPTED_OUTPUTS = 'encrypted_outputs';
|
|
16
16
|
export const USDC_MINT = process.env.NEXT_PUBLIC_USDC_MINT ? new PublicKey(process.env.NEXT_PUBLIC_USDC_MINT) : new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
|
|
17
|
-
const tokenList = ['sol', 'usdc', 'usdt', 'zec', 'ore'];
|
|
18
|
-
const splList = ['usdc', 'usdt', 'zec', 'ore'];
|
|
17
|
+
const tokenList = ['sol', 'usdc', 'usdt', 'zec', 'ore', 'store'];
|
|
18
|
+
const splList = ['usdc', 'usdt', 'zec', 'ore', 'store'];
|
|
19
19
|
export const tokens = [
|
|
20
20
|
{
|
|
21
21
|
name: 'sol',
|
|
@@ -47,4 +47,10 @@ export const tokens = [
|
|
|
47
47
|
prefix: 'ore_',
|
|
48
48
|
units_per_token: 1e11
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
name: 'store',
|
|
52
|
+
pubkey: process.env.NEXT_PUBLIC_STORE_MINT ? new PublicKey(process.env.NEXT_PUBLIC_STORE_MINT) : new PublicKey('sTorERYB6xAZ1SSbwpK3zoK2EEwbBrc7TZAzg1uCGiH'),
|
|
53
|
+
prefix: 'store_',
|
|
54
|
+
units_per_token: 1e11
|
|
55
|
+
},
|
|
50
56
|
];
|
package/package.json
CHANGED
package/src/deposit.ts
CHANGED
|
@@ -62,9 +62,10 @@ type DepositParams = {
|
|
|
62
62
|
keyBasePath: string,
|
|
63
63
|
lightWasm: hasher.LightWasm,
|
|
64
64
|
referrer?: string,
|
|
65
|
+
signer?: PublicKey,
|
|
65
66
|
transactionSigner: (tx: VersionedTransaction) => Promise<VersionedTransaction>
|
|
66
67
|
}
|
|
67
|
-
export async function deposit({ lightWasm, storage, keyBasePath, publicKey, connection, amount_in_lamports, encryptionService, transactionSigner, referrer }: DepositParams) {
|
|
68
|
+
export async function deposit({ lightWasm, storage, keyBasePath, publicKey, connection, amount_in_lamports, encryptionService, transactionSigner, referrer, signer }: DepositParams) {
|
|
68
69
|
// check limit
|
|
69
70
|
let limitAmount = await checkDepositLimit(connection)
|
|
70
71
|
|
|
@@ -72,15 +73,19 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
72
73
|
throw new Error(`Don't deposit more than ${limitAmount} SOL`)
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
if (!signer) {
|
|
77
|
+
signer = publicKey
|
|
78
|
+
}
|
|
79
|
+
|
|
75
80
|
// const amount_in_lamports = amount_in_sol * LAMPORTS_PER_SOL
|
|
76
81
|
const fee_amount_in_lamports = 0
|
|
77
82
|
logger.debug('Encryption key generated from user keypair');
|
|
78
|
-
logger.debug(`User wallet: ${
|
|
83
|
+
logger.debug(`User wallet: ${signer.toString()}`);
|
|
79
84
|
logger.debug(`Deposit amount: ${amount_in_lamports} lamports (${amount_in_lamports / LAMPORTS_PER_SOL} SOL)`);
|
|
80
85
|
logger.debug(`Calculated fee: ${fee_amount_in_lamports} lamports (${fee_amount_in_lamports / LAMPORTS_PER_SOL} SOL)`);
|
|
81
86
|
|
|
82
87
|
// Check wallet balance
|
|
83
|
-
const balance = await connection.getBalance(
|
|
88
|
+
const balance = await connection.getBalance(signer);
|
|
84
89
|
logger.debug(`Wallet balance: ${balance / 1e9} SOL`);
|
|
85
90
|
|
|
86
91
|
if (balance < amount_in_lamports + fee_amount_in_lamports) {
|
|
@@ -374,7 +379,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
374
379
|
// fee recipient
|
|
375
380
|
{ pubkey: FEE_RECIPIENT, isSigner: false, isWritable: true },
|
|
376
381
|
// signer
|
|
377
|
-
{ pubkey:
|
|
382
|
+
{ pubkey: signer, isSigner: true, isWritable: true },
|
|
378
383
|
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
379
384
|
],
|
|
380
385
|
programId: PROGRAM_ID,
|
|
@@ -390,7 +395,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
390
395
|
const recentBlockhash = await connection.getLatestBlockhash();
|
|
391
396
|
|
|
392
397
|
const messageV0 = new TransactionMessage({
|
|
393
|
-
payerKey:
|
|
398
|
+
payerKey: signer, // User pays for their own deposit
|
|
394
399
|
recentBlockhash: recentBlockhash.blockhash,
|
|
395
400
|
instructions: [modifyComputeUnits, depositInstruction],
|
|
396
401
|
}).compileToV0Message([lookupTableAccount.value]);
|
|
@@ -409,7 +414,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
409
414
|
|
|
410
415
|
// Relay the pre-signed transaction to indexer backend
|
|
411
416
|
logger.info('submitting transaction to relayer...')
|
|
412
|
-
const signature = await relayDepositToIndexer(serializedTransaction,
|
|
417
|
+
const signature = await relayDepositToIndexer(serializedTransaction, signer, referrer);
|
|
413
418
|
logger.debug('Transaction signature:', signature);
|
|
414
419
|
logger.debug(`Transaction link: https://explorer.solana.com/tx/${signature}`);
|
|
415
420
|
|
package/src/depositSPL.ts
CHANGED
|
@@ -77,9 +77,10 @@ type DepositParams = {
|
|
|
77
77
|
keyBasePath: string,
|
|
78
78
|
lightWasm: hasher.LightWasm,
|
|
79
79
|
referrer?: string,
|
|
80
|
+
signer?: PublicKey,
|
|
80
81
|
transactionSigner: (tx: VersionedTransaction) => Promise<VersionedTransaction>
|
|
81
82
|
}
|
|
82
|
-
export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, connection, base_units, amount, encryptionService, transactionSigner, referrer, mintAddress }: DepositParams) {
|
|
83
|
+
export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, connection, base_units, amount, encryptionService, transactionSigner, referrer, mintAddress, signer }: DepositParams) {
|
|
83
84
|
if (typeof mintAddress == 'string') {
|
|
84
85
|
mintAddress = new PublicKey(mintAddress)
|
|
85
86
|
}
|
|
@@ -96,6 +97,9 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
96
97
|
throw new Error('You must input at least one of "base_units" or "amount"')
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
if (!signer) {
|
|
101
|
+
signer = publicKey
|
|
102
|
+
}
|
|
99
103
|
|
|
100
104
|
// let mintInfo = await getMint(connection, token.pubkey)
|
|
101
105
|
// let units_per_token = 10 ** mintInfo.decimals
|
|
@@ -113,7 +117,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
113
117
|
);
|
|
114
118
|
let signerTokenAccount = getAssociatedTokenAddressSync(
|
|
115
119
|
token.pubkey,
|
|
116
|
-
|
|
120
|
+
signer
|
|
117
121
|
);
|
|
118
122
|
|
|
119
123
|
// Derive tree account PDA with mint address for SPL
|
|
@@ -130,7 +134,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
130
134
|
// const base_units = amount_in_sol * units_per_token
|
|
131
135
|
const fee_base_units = 0
|
|
132
136
|
logger.debug('Encryption key generated from user keypair');
|
|
133
|
-
logger.debug(`User wallet: ${
|
|
137
|
+
logger.debug(`User wallet: ${signer.toString()}`);
|
|
134
138
|
logger.debug(`Deposit amount: ${base_units} base_units (${base_units / token.units_per_token} ${token.name.toUpperCase()})`);
|
|
135
139
|
logger.debug(`Calculated fee: ${fee_base_units} base_units (${fee_base_units / token.units_per_token} ${token.name.toUpperCase()})`);
|
|
136
140
|
|
|
@@ -146,7 +150,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
// Check SOL balance
|
|
149
|
-
const solBalance = await connection.getBalance(
|
|
153
|
+
const solBalance = await connection.getBalance(signer);
|
|
150
154
|
logger.debug(`SOL Wallet balance: ${solBalance / 1e9} SOL`);
|
|
151
155
|
|
|
152
156
|
if (solBalance / 1e9 < 0.002) {
|
|
@@ -440,7 +444,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
440
444
|
|
|
441
445
|
{ pubkey: globalConfigAccount, isSigner: false, isWritable: false },
|
|
442
446
|
// signer
|
|
443
|
-
{ pubkey:
|
|
447
|
+
{ pubkey: signer, isSigner: true, isWritable: true },
|
|
444
448
|
// SPL token mint
|
|
445
449
|
{ pubkey: token.pubkey, isSigner: false, isWritable: false },
|
|
446
450
|
// signer's token account
|
|
@@ -475,7 +479,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
475
479
|
const recentBlockhash = await connection.getLatestBlockhash();
|
|
476
480
|
|
|
477
481
|
const messageV0 = new TransactionMessage({
|
|
478
|
-
payerKey:
|
|
482
|
+
payerKey: signer, // User pays for their own deposit
|
|
479
483
|
recentBlockhash: recentBlockhash.blockhash,
|
|
480
484
|
instructions: [modifyComputeUnits, depositInstruction],
|
|
481
485
|
}).compileToV0Message([lookupTableAccount.value]);
|
|
@@ -497,7 +501,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
497
501
|
logger.info('submitting transaction to relayer...')
|
|
498
502
|
const signature = await relayDepositToIndexer({
|
|
499
503
|
mintAddress: token.pubkey.toString(),
|
|
500
|
-
publicKey,
|
|
504
|
+
publicKey: signer,
|
|
501
505
|
signedTransaction: serializedTransaction,
|
|
502
506
|
referrer
|
|
503
507
|
});
|
package/src/utils/constants.ts
CHANGED
|
@@ -27,9 +27,9 @@ export const LSK_ENCRYPTED_OUTPUTS = 'encrypted_outputs'
|
|
|
27
27
|
|
|
28
28
|
export const USDC_MINT = process.env.NEXT_PUBLIC_USDC_MINT ? new PublicKey(process.env.NEXT_PUBLIC_USDC_MINT) : new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v')
|
|
29
29
|
|
|
30
|
-
const tokenList = ['sol', 'usdc', 'usdt', 'zec', 'ore'] as const;
|
|
30
|
+
const tokenList = ['sol', 'usdc', 'usdt', 'zec', 'ore', 'store'] as const;
|
|
31
31
|
export type TokenList = typeof tokenList[number];
|
|
32
|
-
const splList = ['usdc', 'usdt', 'zec', 'ore'] as const;
|
|
32
|
+
const splList = ['usdc', 'usdt', 'zec', 'ore', 'store'] as const;
|
|
33
33
|
export type SplList = typeof splList[number];
|
|
34
34
|
export type Token = {
|
|
35
35
|
name: TokenList
|
|
@@ -68,4 +68,10 @@ export const tokens: Token[] = [
|
|
|
68
68
|
prefix: 'ore_',
|
|
69
69
|
units_per_token: 1e11
|
|
70
70
|
},
|
|
71
|
+
{
|
|
72
|
+
name: 'store',
|
|
73
|
+
pubkey: process.env.NEXT_PUBLIC_STORE_MINT ? new PublicKey(process.env.NEXT_PUBLIC_STORE_MINT) : new PublicKey('sTorERYB6xAZ1SSbwpK3zoK2EEwbBrc7TZAzg1uCGiH'),
|
|
74
|
+
prefix: 'store_',
|
|
75
|
+
units_per_token: 1e11
|
|
76
|
+
},
|
|
71
77
|
]
|