@dynamic-labs-wallet/svm 1.1.54 → 1.1.56
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/index.cjs +161 -1
- package/index.esm.js +161 -1
- package/package.json +3 -3
- package/src/svm/client.d.ts +56 -2
- package/src/svm/client.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -409,13 +409,173 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
409
409
|
throw new Error(browser.ERROR_IMPORT_PRIVATE_KEY);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* Generates a Token-2022 confidential-transfer seed inside the enclave and
|
|
414
|
+
* stores the sealed result in CKS. Returns the ElGamal public key.
|
|
415
|
+
*/ createConfidentialSeed({ walletId, solanaAddress, derivationVersion, traceContext }) {
|
|
416
|
+
return this.apiClient.createConfidentialSeed({
|
|
417
|
+
walletId,
|
|
418
|
+
request: {
|
|
419
|
+
derivationVersion,
|
|
420
|
+
solanaAddress
|
|
421
|
+
},
|
|
422
|
+
traceContext
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Signs Token-2022 confidential-transfer transactions in the enclave.
|
|
427
|
+
*
|
|
428
|
+
* The enclave is offline, so missing account states and the latest
|
|
429
|
+
* blockhash are fetched from `rpcUrl`. Pass `broadcast: true` to submit
|
|
430
|
+
* the signed transactions to the cluster in order.
|
|
431
|
+
*/ async signConfidentialTransfer({ walletId, operation, solanaAddress, mint, tokenAccount, destinationTokenAccount, amount, decimals, accountState, destinationAccountState, auditorElgamalPubkey, feePayer, derivationVersion, chainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', lamportsPerByte = '6960', recentBlockhash, lastValidBlockHeight, rpcUrl, broadcast = false, broadcastOptions, traceContext }) {
|
|
432
|
+
const needsAccountState = operation === 'transfer' || operation === 'withdraw' || operation === 'applyPendingBalance';
|
|
433
|
+
const needsDestinationAccountState = operation === 'transfer';
|
|
434
|
+
const mustFetch = broadcast || needsAccountState && !accountState || needsDestinationAccountState && !destinationAccountState || !recentBlockhash || !lastValidBlockHeight;
|
|
435
|
+
if (mustFetch && !rpcUrl) {
|
|
436
|
+
throw new Error('signConfidentialTransfer requires rpcUrl to fetch account state, blockhash, or broadcast');
|
|
437
|
+
}
|
|
438
|
+
if (rpcUrl) {
|
|
439
|
+
if (needsAccountState && !accountState) {
|
|
440
|
+
accountState = await this.svmAccountState(rpcUrl, tokenAccount);
|
|
441
|
+
}
|
|
442
|
+
if (needsDestinationAccountState && !destinationAccountState && destinationTokenAccount) {
|
|
443
|
+
destinationAccountState = await this.svmAccountState(rpcUrl, destinationTokenAccount);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
const blockhashFields = recentBlockhash && lastValidBlockHeight ? {
|
|
447
|
+
recentBlockhash,
|
|
448
|
+
lastValidBlockHeight
|
|
449
|
+
} : await this.confidentialBlockhash(rpcUrl);
|
|
450
|
+
const result = await this.apiClient.signConfidentialTransfer({
|
|
451
|
+
walletId,
|
|
452
|
+
request: {
|
|
453
|
+
accountState,
|
|
454
|
+
amount,
|
|
455
|
+
auditorElgamalPubkey,
|
|
456
|
+
chainId,
|
|
457
|
+
decimals,
|
|
458
|
+
derivationVersion,
|
|
459
|
+
destinationAccountState,
|
|
460
|
+
destinationTokenAccount,
|
|
461
|
+
feePayer,
|
|
462
|
+
lamportsPerByte,
|
|
463
|
+
lastValidBlockHeight: blockhashFields.lastValidBlockHeight,
|
|
464
|
+
mint,
|
|
465
|
+
operation,
|
|
466
|
+
recentBlockhash: blockhashFields.recentBlockhash,
|
|
467
|
+
solanaAddress,
|
|
468
|
+
tokenAccount
|
|
469
|
+
},
|
|
470
|
+
traceContext
|
|
471
|
+
});
|
|
472
|
+
const transactionIds = broadcast ? await this.broadcastConfidentialTransactions(rpcUrl, result.serializedTransactions, broadcastOptions) : undefined;
|
|
473
|
+
return _extends({}, result, {
|
|
474
|
+
transactionIds
|
|
475
|
+
});
|
|
476
|
+
}
|
|
412
477
|
async getSvmWallets() {
|
|
413
478
|
const wallets = await this.getWallets();
|
|
414
479
|
const svmWallets = wallets.filter((wallet)=>wallet.chainName === 'SVM');
|
|
415
480
|
return svmWallets;
|
|
416
481
|
}
|
|
417
482
|
constructor(...args){
|
|
418
|
-
super(...args), this.chainName = 'SVM'
|
|
483
|
+
super(...args), this.chainName = 'SVM', // ---------------------------------------------------------------------------
|
|
484
|
+
// Token-2022 confidential transfers
|
|
485
|
+
// ---------------------------------------------------------------------------
|
|
486
|
+
this.svmRpcCall = async (rpcUrl, method, params)=>{
|
|
487
|
+
const parsedUrl = new URL(rpcUrl);
|
|
488
|
+
const isLocalHttp = parsedUrl.protocol === 'http:' && [
|
|
489
|
+
'localhost',
|
|
490
|
+
'127.0.0.1',
|
|
491
|
+
'[::1]'
|
|
492
|
+
].includes(parsedUrl.hostname);
|
|
493
|
+
if (parsedUrl.protocol !== 'https:' && !isLocalHttp) {
|
|
494
|
+
throw new Error(`Unsupported rpcUrl protocol: ${parsedUrl.protocol}`);
|
|
495
|
+
}
|
|
496
|
+
const response = await fetch(parsedUrl, {
|
|
497
|
+
method: 'POST',
|
|
498
|
+
headers: {
|
|
499
|
+
'content-type': 'application/json'
|
|
500
|
+
},
|
|
501
|
+
body: JSON.stringify({
|
|
502
|
+
jsonrpc: '2.0',
|
|
503
|
+
id: 1,
|
|
504
|
+
method,
|
|
505
|
+
params
|
|
506
|
+
})
|
|
507
|
+
});
|
|
508
|
+
const body = await response.json();
|
|
509
|
+
if (body.error) {
|
|
510
|
+
var _body_error;
|
|
511
|
+
var _body_error_message;
|
|
512
|
+
throw new Error(`Solana RPC ${method} failed: ${(_body_error_message = (_body_error = body.error) == null ? void 0 : _body_error.message) != null ? _body_error_message : JSON.stringify(body.error)}`);
|
|
513
|
+
}
|
|
514
|
+
return body.result;
|
|
515
|
+
}, this.svmAccountState = async (rpcUrl, account)=>{
|
|
516
|
+
const result = await this.svmRpcCall(rpcUrl, 'getAccountInfo', [
|
|
517
|
+
account,
|
|
518
|
+
{
|
|
519
|
+
encoding: 'base64'
|
|
520
|
+
}
|
|
521
|
+
]);
|
|
522
|
+
if (!(result == null ? void 0 : result.value)) {
|
|
523
|
+
throw new Error(`Solana account not found: ${account}`);
|
|
524
|
+
}
|
|
525
|
+
const { data, lamports, owner } = result.value;
|
|
526
|
+
return {
|
|
527
|
+
data: Array.isArray(data) ? data[0] : data,
|
|
528
|
+
lamports: String(lamports),
|
|
529
|
+
owner: String(owner)
|
|
530
|
+
};
|
|
531
|
+
}, this.confidentialBlockhash = async (rpcUrl)=>{
|
|
532
|
+
var _latest_value;
|
|
533
|
+
const latest = rpcUrl ? await this.svmRpcCall(rpcUrl, 'getLatestBlockhash', []) : undefined;
|
|
534
|
+
const recentBlockhash = latest == null ? void 0 : (_latest_value = latest.value) == null ? void 0 : _latest_value.blockhash;
|
|
535
|
+
const lastValidBlockHeight = (latest == null ? void 0 : latest.value) ? String(latest.value.lastValidBlockHeight) : undefined;
|
|
536
|
+
if (!recentBlockhash || !lastValidBlockHeight) {
|
|
537
|
+
throw new Error('signConfidentialTransfer requires rpcUrl to fetch the latest blockhash');
|
|
538
|
+
}
|
|
539
|
+
return {
|
|
540
|
+
lastValidBlockHeight,
|
|
541
|
+
recentBlockhash
|
|
542
|
+
};
|
|
543
|
+
}, this.broadcastConfidentialTransactions = async (rpcUrl, serializedTransactions, broadcastOptions)=>serializedTransactions.reduce(async (accPromise, serializedTransaction)=>{
|
|
544
|
+
const acc = await accPromise;
|
|
545
|
+
const transactionId = await this.svmRpcCall(rpcUrl, 'sendTransaction', [
|
|
546
|
+
serializedTransaction,
|
|
547
|
+
_extends({
|
|
548
|
+
encoding: 'base64'
|
|
549
|
+
}, broadcastOptions)
|
|
550
|
+
]);
|
|
551
|
+
// Confidential plans are order-dependent: confirm before submitting
|
|
552
|
+
// the next transaction or Solana may process them out of order.
|
|
553
|
+
await this.waitForConfidentialConfirmation(rpcUrl, transactionId);
|
|
554
|
+
acc.push(transactionId);
|
|
555
|
+
return acc;
|
|
556
|
+
}, Promise.resolve([])), this.waitForConfidentialConfirmation = async (rpcUrl, transactionId, attemptsLeft = 30)=>{
|
|
557
|
+
var _result_value;
|
|
558
|
+
const result = await this.svmRpcCall(rpcUrl, 'getSignatureStatuses', [
|
|
559
|
+
[
|
|
560
|
+
transactionId
|
|
561
|
+
]
|
|
562
|
+
]);
|
|
563
|
+
const status = result == null ? void 0 : (_result_value = result.value) == null ? void 0 : _result_value[0];
|
|
564
|
+
if (status == null ? void 0 : status.err) {
|
|
565
|
+
throw new Error(`Confidential transaction failed: ${JSON.stringify({
|
|
566
|
+
transactionId,
|
|
567
|
+
err: status.err
|
|
568
|
+
})}`);
|
|
569
|
+
}
|
|
570
|
+
if ((status == null ? void 0 : status.confirmationStatus) === 'confirmed' || (status == null ? void 0 : status.confirmationStatus) === 'finalized') {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (attemptsLeft <= 1) {
|
|
574
|
+
throw new Error(`Timed out waiting for confidential transaction ${transactionId} to confirm`);
|
|
575
|
+
}
|
|
576
|
+
await new Promise((resolve)=>setTimeout(resolve, 1000));
|
|
577
|
+
await this.waitForConfidentialConfirmation(rpcUrl, transactionId, attemptsLeft - 1);
|
|
578
|
+
};
|
|
419
579
|
}
|
|
420
580
|
}
|
|
421
581
|
|
package/index.esm.js
CHANGED
|
@@ -407,13 +407,173 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
407
407
|
throw new Error(ERROR_IMPORT_PRIVATE_KEY);
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Generates a Token-2022 confidential-transfer seed inside the enclave and
|
|
412
|
+
* stores the sealed result in CKS. Returns the ElGamal public key.
|
|
413
|
+
*/ createConfidentialSeed({ walletId, solanaAddress, derivationVersion, traceContext }) {
|
|
414
|
+
return this.apiClient.createConfidentialSeed({
|
|
415
|
+
walletId,
|
|
416
|
+
request: {
|
|
417
|
+
derivationVersion,
|
|
418
|
+
solanaAddress
|
|
419
|
+
},
|
|
420
|
+
traceContext
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Signs Token-2022 confidential-transfer transactions in the enclave.
|
|
425
|
+
*
|
|
426
|
+
* The enclave is offline, so missing account states and the latest
|
|
427
|
+
* blockhash are fetched from `rpcUrl`. Pass `broadcast: true` to submit
|
|
428
|
+
* the signed transactions to the cluster in order.
|
|
429
|
+
*/ async signConfidentialTransfer({ walletId, operation, solanaAddress, mint, tokenAccount, destinationTokenAccount, amount, decimals, accountState, destinationAccountState, auditorElgamalPubkey, feePayer, derivationVersion, chainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', lamportsPerByte = '6960', recentBlockhash, lastValidBlockHeight, rpcUrl, broadcast = false, broadcastOptions, traceContext }) {
|
|
430
|
+
const needsAccountState = operation === 'transfer' || operation === 'withdraw' || operation === 'applyPendingBalance';
|
|
431
|
+
const needsDestinationAccountState = operation === 'transfer';
|
|
432
|
+
const mustFetch = broadcast || needsAccountState && !accountState || needsDestinationAccountState && !destinationAccountState || !recentBlockhash || !lastValidBlockHeight;
|
|
433
|
+
if (mustFetch && !rpcUrl) {
|
|
434
|
+
throw new Error('signConfidentialTransfer requires rpcUrl to fetch account state, blockhash, or broadcast');
|
|
435
|
+
}
|
|
436
|
+
if (rpcUrl) {
|
|
437
|
+
if (needsAccountState && !accountState) {
|
|
438
|
+
accountState = await this.svmAccountState(rpcUrl, tokenAccount);
|
|
439
|
+
}
|
|
440
|
+
if (needsDestinationAccountState && !destinationAccountState && destinationTokenAccount) {
|
|
441
|
+
destinationAccountState = await this.svmAccountState(rpcUrl, destinationTokenAccount);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
const blockhashFields = recentBlockhash && lastValidBlockHeight ? {
|
|
445
|
+
recentBlockhash,
|
|
446
|
+
lastValidBlockHeight
|
|
447
|
+
} : await this.confidentialBlockhash(rpcUrl);
|
|
448
|
+
const result = await this.apiClient.signConfidentialTransfer({
|
|
449
|
+
walletId,
|
|
450
|
+
request: {
|
|
451
|
+
accountState,
|
|
452
|
+
amount,
|
|
453
|
+
auditorElgamalPubkey,
|
|
454
|
+
chainId,
|
|
455
|
+
decimals,
|
|
456
|
+
derivationVersion,
|
|
457
|
+
destinationAccountState,
|
|
458
|
+
destinationTokenAccount,
|
|
459
|
+
feePayer,
|
|
460
|
+
lamportsPerByte,
|
|
461
|
+
lastValidBlockHeight: blockhashFields.lastValidBlockHeight,
|
|
462
|
+
mint,
|
|
463
|
+
operation,
|
|
464
|
+
recentBlockhash: blockhashFields.recentBlockhash,
|
|
465
|
+
solanaAddress,
|
|
466
|
+
tokenAccount
|
|
467
|
+
},
|
|
468
|
+
traceContext
|
|
469
|
+
});
|
|
470
|
+
const transactionIds = broadcast ? await this.broadcastConfidentialTransactions(rpcUrl, result.serializedTransactions, broadcastOptions) : undefined;
|
|
471
|
+
return _extends({}, result, {
|
|
472
|
+
transactionIds
|
|
473
|
+
});
|
|
474
|
+
}
|
|
410
475
|
async getSvmWallets() {
|
|
411
476
|
const wallets = await this.getWallets();
|
|
412
477
|
const svmWallets = wallets.filter((wallet)=>wallet.chainName === 'SVM');
|
|
413
478
|
return svmWallets;
|
|
414
479
|
}
|
|
415
480
|
constructor(...args){
|
|
416
|
-
super(...args), this.chainName = 'SVM'
|
|
481
|
+
super(...args), this.chainName = 'SVM', // ---------------------------------------------------------------------------
|
|
482
|
+
// Token-2022 confidential transfers
|
|
483
|
+
// ---------------------------------------------------------------------------
|
|
484
|
+
this.svmRpcCall = async (rpcUrl, method, params)=>{
|
|
485
|
+
const parsedUrl = new URL(rpcUrl);
|
|
486
|
+
const isLocalHttp = parsedUrl.protocol === 'http:' && [
|
|
487
|
+
'localhost',
|
|
488
|
+
'127.0.0.1',
|
|
489
|
+
'[::1]'
|
|
490
|
+
].includes(parsedUrl.hostname);
|
|
491
|
+
if (parsedUrl.protocol !== 'https:' && !isLocalHttp) {
|
|
492
|
+
throw new Error(`Unsupported rpcUrl protocol: ${parsedUrl.protocol}`);
|
|
493
|
+
}
|
|
494
|
+
const response = await fetch(parsedUrl, {
|
|
495
|
+
method: 'POST',
|
|
496
|
+
headers: {
|
|
497
|
+
'content-type': 'application/json'
|
|
498
|
+
},
|
|
499
|
+
body: JSON.stringify({
|
|
500
|
+
jsonrpc: '2.0',
|
|
501
|
+
id: 1,
|
|
502
|
+
method,
|
|
503
|
+
params
|
|
504
|
+
})
|
|
505
|
+
});
|
|
506
|
+
const body = await response.json();
|
|
507
|
+
if (body.error) {
|
|
508
|
+
var _body_error;
|
|
509
|
+
var _body_error_message;
|
|
510
|
+
throw new Error(`Solana RPC ${method} failed: ${(_body_error_message = (_body_error = body.error) == null ? void 0 : _body_error.message) != null ? _body_error_message : JSON.stringify(body.error)}`);
|
|
511
|
+
}
|
|
512
|
+
return body.result;
|
|
513
|
+
}, this.svmAccountState = async (rpcUrl, account)=>{
|
|
514
|
+
const result = await this.svmRpcCall(rpcUrl, 'getAccountInfo', [
|
|
515
|
+
account,
|
|
516
|
+
{
|
|
517
|
+
encoding: 'base64'
|
|
518
|
+
}
|
|
519
|
+
]);
|
|
520
|
+
if (!(result == null ? void 0 : result.value)) {
|
|
521
|
+
throw new Error(`Solana account not found: ${account}`);
|
|
522
|
+
}
|
|
523
|
+
const { data, lamports, owner } = result.value;
|
|
524
|
+
return {
|
|
525
|
+
data: Array.isArray(data) ? data[0] : data,
|
|
526
|
+
lamports: String(lamports),
|
|
527
|
+
owner: String(owner)
|
|
528
|
+
};
|
|
529
|
+
}, this.confidentialBlockhash = async (rpcUrl)=>{
|
|
530
|
+
var _latest_value;
|
|
531
|
+
const latest = rpcUrl ? await this.svmRpcCall(rpcUrl, 'getLatestBlockhash', []) : undefined;
|
|
532
|
+
const recentBlockhash = latest == null ? void 0 : (_latest_value = latest.value) == null ? void 0 : _latest_value.blockhash;
|
|
533
|
+
const lastValidBlockHeight = (latest == null ? void 0 : latest.value) ? String(latest.value.lastValidBlockHeight) : undefined;
|
|
534
|
+
if (!recentBlockhash || !lastValidBlockHeight) {
|
|
535
|
+
throw new Error('signConfidentialTransfer requires rpcUrl to fetch the latest blockhash');
|
|
536
|
+
}
|
|
537
|
+
return {
|
|
538
|
+
lastValidBlockHeight,
|
|
539
|
+
recentBlockhash
|
|
540
|
+
};
|
|
541
|
+
}, this.broadcastConfidentialTransactions = async (rpcUrl, serializedTransactions, broadcastOptions)=>serializedTransactions.reduce(async (accPromise, serializedTransaction)=>{
|
|
542
|
+
const acc = await accPromise;
|
|
543
|
+
const transactionId = await this.svmRpcCall(rpcUrl, 'sendTransaction', [
|
|
544
|
+
serializedTransaction,
|
|
545
|
+
_extends({
|
|
546
|
+
encoding: 'base64'
|
|
547
|
+
}, broadcastOptions)
|
|
548
|
+
]);
|
|
549
|
+
// Confidential plans are order-dependent: confirm before submitting
|
|
550
|
+
// the next transaction or Solana may process them out of order.
|
|
551
|
+
await this.waitForConfidentialConfirmation(rpcUrl, transactionId);
|
|
552
|
+
acc.push(transactionId);
|
|
553
|
+
return acc;
|
|
554
|
+
}, Promise.resolve([])), this.waitForConfidentialConfirmation = async (rpcUrl, transactionId, attemptsLeft = 30)=>{
|
|
555
|
+
var _result_value;
|
|
556
|
+
const result = await this.svmRpcCall(rpcUrl, 'getSignatureStatuses', [
|
|
557
|
+
[
|
|
558
|
+
transactionId
|
|
559
|
+
]
|
|
560
|
+
]);
|
|
561
|
+
const status = result == null ? void 0 : (_result_value = result.value) == null ? void 0 : _result_value[0];
|
|
562
|
+
if (status == null ? void 0 : status.err) {
|
|
563
|
+
throw new Error(`Confidential transaction failed: ${JSON.stringify({
|
|
564
|
+
transactionId,
|
|
565
|
+
err: status.err
|
|
566
|
+
})}`);
|
|
567
|
+
}
|
|
568
|
+
if ((status == null ? void 0 : status.confirmationStatus) === 'confirmed' || (status == null ? void 0 : status.confirmationStatus) === 'finalized') {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (attemptsLeft <= 1) {
|
|
572
|
+
throw new Error(`Timed out waiting for confidential transaction ${transactionId} to confirm`);
|
|
573
|
+
}
|
|
574
|
+
await new Promise((resolve)=>setTimeout(resolve, 1000));
|
|
575
|
+
await this.waitForConfidentialConfirmation(rpcUrl, transactionId, attemptsLeft - 1);
|
|
576
|
+
};
|
|
417
577
|
}
|
|
418
578
|
}
|
|
419
579
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/svm",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.56",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/browser": "1.1.
|
|
8
|
-
"@dynamic-labs-wallet/core": "1.1.
|
|
7
|
+
"@dynamic-labs-wallet/browser": "1.1.56",
|
|
8
|
+
"@dynamic-labs-wallet/core": "1.1.56",
|
|
9
9
|
"@solana/web3.js": "^1.98.2",
|
|
10
10
|
"bs58": "^6.0.0",
|
|
11
11
|
"@dynamic-labs/sdk-api-core": "0.115.0"
|
package/src/svm/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DynamicWalletClient, type Ed25519KeygenResult, type ThresholdSignatureScheme, type TraceContext, type RequestWithElevatedAccessToken, type BaseSignParams, type SignAndBroadcastResponse, type ExportApprovalQuorumRequest } from '@dynamic-labs-wallet/browser';
|
|
1
|
+
import { DynamicWalletClient, type Ed25519KeygenResult, type ThresholdSignatureScheme, type TraceContext, type RequestWithElevatedAccessToken, type BaseSignParams, type SignAndBroadcastResponse, type ExportApprovalQuorumRequest, type ConfidentialAccountState, type ConfidentialTransferOperation } from '@dynamic-labs-wallet/browser';
|
|
2
2
|
export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
3
3
|
readonly chainName = "SVM";
|
|
4
|
-
accountAddress?: string;
|
|
4
|
+
readonly accountAddress?: string;
|
|
5
5
|
/**
|
|
6
6
|
* Creates a wallet account on the Solana chain
|
|
7
7
|
*
|
|
@@ -145,6 +145,60 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
145
145
|
accountAddress: string;
|
|
146
146
|
rawPublicKey: Uint8Array | undefined;
|
|
147
147
|
}>;
|
|
148
|
+
private readonly svmRpcCall;
|
|
149
|
+
private readonly svmAccountState;
|
|
150
|
+
private readonly confidentialBlockhash;
|
|
151
|
+
private readonly broadcastConfidentialTransactions;
|
|
152
|
+
private readonly waitForConfidentialConfirmation;
|
|
153
|
+
/**
|
|
154
|
+
* Generates a Token-2022 confidential-transfer seed inside the enclave and
|
|
155
|
+
* stores the sealed result in CKS. Returns the ElGamal public key.
|
|
156
|
+
*/
|
|
157
|
+
createConfidentialSeed({ walletId, solanaAddress, derivationVersion, traceContext, }: {
|
|
158
|
+
walletId: string;
|
|
159
|
+
solanaAddress: string;
|
|
160
|
+
derivationVersion?: number;
|
|
161
|
+
traceContext?: TraceContext;
|
|
162
|
+
}): Promise<import("@dynamic-labs-wallet/browser").CreateConfidentialSeedResponse>;
|
|
163
|
+
/**
|
|
164
|
+
* Signs Token-2022 confidential-transfer transactions in the enclave.
|
|
165
|
+
*
|
|
166
|
+
* The enclave is offline, so missing account states and the latest
|
|
167
|
+
* blockhash are fetched from `rpcUrl`. Pass `broadcast: true` to submit
|
|
168
|
+
* the signed transactions to the cluster in order.
|
|
169
|
+
*/
|
|
170
|
+
signConfidentialTransfer({ walletId, operation, solanaAddress, mint, tokenAccount, destinationTokenAccount, amount, decimals, accountState, destinationAccountState, auditorElgamalPubkey, feePayer, derivationVersion, chainId, lamportsPerByte, recentBlockhash, lastValidBlockHeight, rpcUrl, broadcast, broadcastOptions, traceContext, }: {
|
|
171
|
+
walletId: string;
|
|
172
|
+
operation: ConfidentialTransferOperation;
|
|
173
|
+
solanaAddress: string;
|
|
174
|
+
mint: string;
|
|
175
|
+
tokenAccount: string;
|
|
176
|
+
destinationTokenAccount?: string;
|
|
177
|
+
amount?: string;
|
|
178
|
+
decimals?: number;
|
|
179
|
+
accountState?: ConfidentialAccountState;
|
|
180
|
+
destinationAccountState?: ConfidentialAccountState;
|
|
181
|
+
auditorElgamalPubkey?: string;
|
|
182
|
+
feePayer?: string;
|
|
183
|
+
derivationVersion?: number;
|
|
184
|
+
chainId?: string;
|
|
185
|
+
lamportsPerByte?: string;
|
|
186
|
+
/** Fetched from `rpcUrl` when omitted. */
|
|
187
|
+
recentBlockhash?: string;
|
|
188
|
+
lastValidBlockHeight?: string;
|
|
189
|
+
/** Solana JSON-RPC endpoint, required to fetch account state / blockhash or to broadcast. */
|
|
190
|
+
rpcUrl?: string;
|
|
191
|
+
broadcast?: boolean;
|
|
192
|
+
broadcastOptions?: {
|
|
193
|
+
skipPreflight?: boolean;
|
|
194
|
+
preflightCommitment?: string;
|
|
195
|
+
};
|
|
196
|
+
traceContext?: TraceContext;
|
|
197
|
+
}): Promise<{
|
|
198
|
+
transactionIds: string[] | undefined;
|
|
199
|
+
serializedTransactions: string[];
|
|
200
|
+
signatures: string[];
|
|
201
|
+
}>;
|
|
148
202
|
getSvmWallets(): Promise<any>;
|
|
149
203
|
}
|
|
150
204
|
//# sourceMappingURL=client.d.ts.map
|
package/src/svm/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/svm/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAUnB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,8BAA8B,EAEnC,KAAK,cAAc,EAEnB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/svm/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAUnB,KAA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