@dynamic-labs/waas-svm 4.9.2-preview.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/CHANGELOG.md +5099 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/_virtual/_tslib.cjs +36 -0
- package/_virtual/_tslib.js +32 -0
- package/package.cjs +8 -0
- package/package.js +4 -0
- package/package.json +33 -0
- package/src/DynamicWaasSvmConnectors.cjs +10 -0
- package/src/DynamicWaasSvmConnectors.d.ts +2 -0
- package/src/DynamicWaasSvmConnectors.js +6 -0
- package/src/connector/DynamicWaasSVMConnector.cjs +204 -0
- package/src/connector/DynamicWaasSVMConnector.d.ts +46 -0
- package/src/connector/DynamicWaasSVMConnector.js +200 -0
- package/src/index.cjs +14 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +7 -0
- package/src/signer/DynamicWaasSVMSigner.cjs +77 -0
- package/src/signer/DynamicWaasSVMSigner.d.ts +35 -0
- package/src/signer/DynamicWaasSVMSigner.js +69 -0
- package/utils/logger.cjs +10 -0
- package/utils/logger.d.ts +2 -0
- package/utils/logger.js +6 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var web3_js = require('@solana/web3.js');
|
|
8
|
+
var EventEmitter = require('eventemitter3');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Signer implementation for DynamicWaasSVMConnector
|
|
16
|
+
* This class provides a similar interface to TurnkeySolanaSigner
|
|
17
|
+
*/
|
|
18
|
+
class DynamicWaasSVMSigner extends EventEmitter__default["default"] {
|
|
19
|
+
constructor({ walletConnector, }) {
|
|
20
|
+
super();
|
|
21
|
+
// ISolanaSigner properties
|
|
22
|
+
this.isConnected = true;
|
|
23
|
+
this.providers = [this];
|
|
24
|
+
this.isBraveWallet = false;
|
|
25
|
+
this.isGlow = false;
|
|
26
|
+
this.isPhantom = false;
|
|
27
|
+
this.isSolflare = false;
|
|
28
|
+
this.isExodus = false;
|
|
29
|
+
this.isBackpack = false;
|
|
30
|
+
this.isMagicEden = false;
|
|
31
|
+
this.walletConnector = walletConnector;
|
|
32
|
+
this.accountAddress = this.walletConnector.activeAccountAddress;
|
|
33
|
+
this.publicKey = this.accountAddress
|
|
34
|
+
? new web3_js.PublicKey(this.accountAddress)
|
|
35
|
+
: undefined;
|
|
36
|
+
}
|
|
37
|
+
signMessage(encodedMessage) {
|
|
38
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
// Convert Uint8Array to string for the DynamicWaasSVMConnector
|
|
40
|
+
const messageString = Buffer.from(encodedMessage).toString();
|
|
41
|
+
const signedMessage = yield this.walletConnector.signMessage(messageString);
|
|
42
|
+
// Convert hex string to Uint8Array
|
|
43
|
+
const signatureBytes = new Uint8Array(Buffer.from(signedMessage, 'hex'));
|
|
44
|
+
return { signature: signatureBytes };
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
signTransaction(transaction) {
|
|
48
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
return this.walletConnector.signTransaction(transaction);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
signAllTransactions(transactions) {
|
|
53
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return this.walletConnector.signAllTransactions(transactions);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
signAndSendTransaction(transaction, options) {
|
|
58
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const signature = yield this.walletConnector.signAndSendTransaction(transaction, options);
|
|
60
|
+
return { signature };
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
connect(
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
65
|
+
_args) {
|
|
66
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return { address: this.accountAddress, publicKey: this.publicKey };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
disconnect() {
|
|
71
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.DynamicWaasSVMSigner = DynamicWaasSVMSigner;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PublicKey, SendOptions, Transaction, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
import EventEmitter from 'eventemitter3';
|
|
3
|
+
import { SignedMessage, ISolanaSigner, ConnectionResult, ISolanaEvents } from '@dynamic-labs/solana-core';
|
|
4
|
+
import { DynamicWaasSVMConnector } from '../connector/DynamicWaasSVMConnector';
|
|
5
|
+
/**
|
|
6
|
+
* Signer implementation for DynamicWaasSVMConnector
|
|
7
|
+
* This class provides a similar interface to TurnkeySolanaSigner
|
|
8
|
+
*/
|
|
9
|
+
export declare class DynamicWaasSVMSigner extends EventEmitter<ISolanaEvents> implements ISolanaSigner {
|
|
10
|
+
readonly isConnected = true;
|
|
11
|
+
readonly publicKey: PublicKey | undefined;
|
|
12
|
+
readonly providers: ISolanaSigner[];
|
|
13
|
+
readonly isBraveWallet = false;
|
|
14
|
+
readonly isGlow = false;
|
|
15
|
+
readonly isPhantom = false;
|
|
16
|
+
readonly isSolflare = false;
|
|
17
|
+
readonly isExodus = false;
|
|
18
|
+
readonly isBackpack = false;
|
|
19
|
+
readonly isMagicEden = false;
|
|
20
|
+
private readonly accountAddress;
|
|
21
|
+
private walletConnector;
|
|
22
|
+
constructor({ walletConnector, }: {
|
|
23
|
+
walletConnector: DynamicWaasSVMConnector;
|
|
24
|
+
});
|
|
25
|
+
signMessage(encodedMessage: Uint8Array): Promise<SignedMessage>;
|
|
26
|
+
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
27
|
+
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
28
|
+
signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions): Promise<{
|
|
29
|
+
signature: TransactionSignature;
|
|
30
|
+
}>;
|
|
31
|
+
connect(_args?: {
|
|
32
|
+
onlyIfTrusted?: boolean;
|
|
33
|
+
}): Promise<ConnectionResult>;
|
|
34
|
+
disconnect(): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
|
4
|
+
import EventEmitter from 'eventemitter3';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Signer implementation for DynamicWaasSVMConnector
|
|
8
|
+
* This class provides a similar interface to TurnkeySolanaSigner
|
|
9
|
+
*/
|
|
10
|
+
class DynamicWaasSVMSigner extends EventEmitter {
|
|
11
|
+
constructor({ walletConnector, }) {
|
|
12
|
+
super();
|
|
13
|
+
// ISolanaSigner properties
|
|
14
|
+
this.isConnected = true;
|
|
15
|
+
this.providers = [this];
|
|
16
|
+
this.isBraveWallet = false;
|
|
17
|
+
this.isGlow = false;
|
|
18
|
+
this.isPhantom = false;
|
|
19
|
+
this.isSolflare = false;
|
|
20
|
+
this.isExodus = false;
|
|
21
|
+
this.isBackpack = false;
|
|
22
|
+
this.isMagicEden = false;
|
|
23
|
+
this.walletConnector = walletConnector;
|
|
24
|
+
this.accountAddress = this.walletConnector.activeAccountAddress;
|
|
25
|
+
this.publicKey = this.accountAddress
|
|
26
|
+
? new PublicKey(this.accountAddress)
|
|
27
|
+
: undefined;
|
|
28
|
+
}
|
|
29
|
+
signMessage(encodedMessage) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
// Convert Uint8Array to string for the DynamicWaasSVMConnector
|
|
32
|
+
const messageString = Buffer.from(encodedMessage).toString();
|
|
33
|
+
const signedMessage = yield this.walletConnector.signMessage(messageString);
|
|
34
|
+
// Convert hex string to Uint8Array
|
|
35
|
+
const signatureBytes = new Uint8Array(Buffer.from(signedMessage, 'hex'));
|
|
36
|
+
return { signature: signatureBytes };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
signTransaction(transaction) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return this.walletConnector.signTransaction(transaction);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
signAllTransactions(transactions) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return this.walletConnector.signAllTransactions(transactions);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
signAndSendTransaction(transaction, options) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const signature = yield this.walletConnector.signAndSendTransaction(transaction, options);
|
|
52
|
+
return { signature };
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
connect(
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
|
+
_args) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return { address: this.accountAddress, publicKey: this.publicKey };
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
disconnect() {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { DynamicWaasSVMSigner };
|
package/utils/logger.cjs
ADDED