
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@vite/connector
Advanced tools
@vite/connector is the client sdk forked from WalletConnect, with extensive modification to be vite adaptive.
@vite/connector can be used in html project.
yarn add @vite/connector
# OR
npm install --save @vite/connector
import Connector from '@vite/connector'
const BRIDGE = 'vite-connect-bridge ws server url'
const vbInstance = new Connector({ bridge: BRIDGE })
vbInstance.createSession().then(() => {
// vbInstance.uri can be turn to an QR code image.
// Then scan the QR code image with Vite App.
console.log('connect uri', vbInstance.uri)
});
vbInstance.on('connect', (err, payload) => {
/*
* Payload is an Object match the following interface:
* Usually peer is the Vite App.
* {
* version: number, // vite connector version, usually is 2
* peerId: string, // can ignore
* peerMeta: { // Vite App meta info, can show in the html
* bridgeVersion: number,
* description: string,
* url: string,
* icons: string[],
* name: string,
* },
* chainId: number, // can ignore
* accounts: string[] // the address get from Vite App.
* }
*/
const { accounts } = payload.params[0];
if (!accounts || !accounts[0]) throw new Error('address is null');
const address = accounts[0];
console.log(address)
})
// send tx
vbInstance.sendCustomRequest({
method: 'vite_signAndSendTx',
params: {
/*
* block should match the interface:
{
toAddress: string; // regular user address or contract address
tokenId: string;
amount: string; // in atomic unit
fee?: string; // in atomic unit
data? string; // base64 string
}
* the field `data`, can be generate:
* 1. regular transfer, refer to https://vite.wiki/api/vitejs/accountBlock/utils.html#messagetodata
* 2. call contract method, use vitejs-utils and vitejs-abi, refer to https://github.com/vitelabs/bridge#example
*/
block: {
accountAddress: "vite_61404d3b6361f979208c8a5c442ceb87c1f072446f58118f68",
amount: "2000000000000000000",
data: "c2FkZmFzZg==",
toAddress: "vite_61404d3b6361f979208c8a5c442ceb87c1f072446f58118f68",
tokenId: "tti_5649544520544f4b454e6e40",
},
}
}).then(signedBlock => console.log(signedBlock), err => console.error(err))
vbInstance.on('disconnect', err => {
console.log(err)
})
FAQs
vite connect client sdk
The npm package @vite/connector receives a total of 2 weekly downloads. As such, @vite/connector popularity was classified as not popular.
We found that @vite/connector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.