![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@mysten/wallet-standard
Advanced tools
A suite of standard utilities for implementing wallets based on the Wallet Standard.
@mysten/wallet-standard
A suite of standard utilities for implementing wallets and libraries based on the Wallet Standard.
You need to create a class that represents your wallet. You can use the Wallet
interface from @mysten/wallet-standard
to help ensure your class adheres to the standard.
import { Wallet, SUI_DEVNET_CHAIN } from "@mysten/wallet-standard";
class YourWallet implements Wallet {
get version() {
// Return the version of the Wallet Standard this implements (in this case, 1.0.0).
return "1.0.0";
}
get name() {
return "Wallet Name";
}
get icon() {
return "some-icon-data-url";
}
// Return the Sui chains that your wallet supports.
get chains() {
return [SUI_DEVNET_CHAIN];
}
}
Features are standard methods consumers can use to interact with a wallet. To be listed in the Sui wallet adapter, you must implement the following features in your wallet:
standard:connect
- Used to initiate a connection to the wallet.standard:events
- Used to listen for changes that happen within the wallet, such as accounts being added or removed.sui:signAndExecuteTransaction
- Used to prompt the user to sign a transaction, then submit it for execution to the blockchain.You can implement these features in your wallet class under the features
property:
import {
ConnectFeature,
ConnectMethod,
EventsFeature,
EventsOnMethod,
SuiSignAndExecuteTransactionFeature,
SuiSignAndExecuteTransactionMethod
} from "@mysten/wallet-standard";
class YourWallet implements Wallet {
get features(): ConnectFeature & EventsFeature & SuiSignAndExecuteTransactionFeature {
return {
"standard:connect": {
version: "1.0.0",
connect: this.#connect,
},
"standard:events": {
version: "1.0.0",
on: this.#on,
}
"sui:signAndExecuteTransaction": {
version: "1.0.0",
signAndExecuteTransaction: this.#signAndExecuteTransaction,
},
};
},
#on: EventsOnMethod = () => {
// Your wallet's events on implementation.
};
#connect: ConnectMethod = () => {
// Your wallet's connect implementation
};
#signAndExecuteTransaction: SuiSignAndExecuteTransactionMethod = () => {
// Your wallet's signAndExecuteTransaction implementation
};
}
The last requirement of the wallet interface is to expose an acccounts
interface. This should expose all of the accounts that a connected dapp has access to. It can be empty prior to initiating a connection through the standard:connect
feature.
The accounts can use the ReadonlyWalletAccount
class to easily construct an account matching the required interface.
import { ReadonlyWalletAccount } from "@mysten/wallet-standard";
class YourWallet implements Wallet {
get accounts() {
// Assuming we already have some internal representation of accounts:
return someWalletAccounts.map(
(walletAccount) =>
// Return
new ReadonlyWalletAccount({
address: walletAccount.suiAddress,
publicKey: walletAccount.pubkey,
// The Sui chains that your wallet supports.
chains: [SUI_DEVNET_CHAIN],
// The features that this account supports. This can be a subset of the wallet's supported features.
// These features must exist on the wallet as well.
features: ["sui:signAndExecuteTransaction"],
})
);
}
}
Once you have a compatible interface for your wallet, you can register it using the registerWallet
function.
import { registerWallet } from '@mysten/wallet-standard';
registerWallet(new YourWallet());
If you're interested in the internal implementation of the
registerWallet
method, you can see how it works here.
FAQs
A suite of standard utilities for implementing wallets based on the Wallet Standard.
The npm package @mysten/wallet-standard receives a total of 19,220 weekly downloads. As such, @mysten/wallet-standard popularity was classified as popular.
We found that @mysten/wallet-standard demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.