Skip to content

Commit

Permalink
bump v, upd snap tx flow
Browse files Browse the repository at this point in the history
  • Loading branch information
lukachi committed Aug 2, 2024
1 parent e101fbb commit d7ed189
Show file tree
Hide file tree
Showing 8 changed files with 1,430 additions and 1,297 deletions.
4 changes: 3 additions & 1 deletion packages/connector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qtumproject/qtum-wallet-connector",
"version": "0.1.0",
"version": "0.2.0-rc.0",
"description": "A Provider to be used in ethers.js to interact with Qtum's wallet",
"repository": {
"type": "git",
Expand Down Expand Up @@ -53,6 +53,8 @@
"@ethersproject/abstract-provider": "5.7.0",
"@ethersproject/properties": "^5.7.0",
"@ethersproject/providers": "5.7.2",
"bs58check": "^4.0.0",
"buffer": "^6.0.3",
"compare-versions": "^6.1.0",
"ethers": "5.7.2"
},
Expand Down
18 changes: 18 additions & 0 deletions packages/connector/src/helpers/address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import bs58check from 'bs58check';
import { Buffer } from 'buffer';

Check failure on line 2 in packages/connector/src/helpers/address.ts

View workflow job for this annotation

GitHub Actions / build_and_test (18)

Do not import Node.js builtin module "buffer"

// eslint-disable-next-line jsdoc/require-jsdoc
export function toBase58Check(ethAddress: string, version: number) {
const hash = Buffer.from(ethAddress.slice(2), 'hex');
const payload = Buffer.allocUnsafe(21);
payload.writeUInt8(version, 0);
hash.copy(payload, 1);
return bs58check.encode(payload);
}

// eslint-disable-next-line jsdoc/require-jsdoc
export function fromBase58Check(qtumAddress: string) {
const payload = bs58check.decode(qtumAddress);
const buffer = Buffer.from(payload);
return `0x${buffer.toString('hex').slice(2)}`;
}
1 change: 1 addition & 0 deletions packages/connector/src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './snap';
export * from './promise';
export * from './error-helper';
export * from './address';
2 changes: 1 addition & 1 deletion packages/connector/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.1.0"
"version": "0.2.0-rc.0"
}
3 changes: 2 additions & 1 deletion packages/snap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qtumproject/qtum-wallet",
"version": "0.1.0",
"version": "0.2.0-rc.0",
"description": "Qtum Wallet is a MetaMask Snap that plays the role of the RPC proxy that accepts requests to the MetaMask and forwards them to the Qtum network with the Qtum ethers adapter.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -44,6 +44,7 @@
"@metamask/transaction-controller": "^27.0.1",
"@qtumproject/qtum-wallet-connector": "workspace:^",
"buffer": "6.0.3",
"eth-block-tracker": "^8.1.0",
"ethers": "5.7.2",
"intl": "1.2.5",
"key-did-provider-ed25519": "3.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "0.1.0",
"version": "0.2.0-rc.0",
"description": "Qtum Wallet is a MetaMask Snap that plays the role of the RPC proxy that accepts requests to the MetaMask and forwards them to the Qtum network with the Qtum ethers adapter.",
"proposedName": "Qtum Wallet",
"repository": {
"type": "git",
"url": "https://github.com/qtumproject/qtum-extension-wallet.git"
},
"source": {
"shasum": "GCvOxV52DlGWa+wGp9FEkLAV8STusflG65XGtujPtEc=",
"shasum": "oEAC3H93bXlhAbsFeEtAXnnTHKxnGlNDb+efb6TWEos=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
7 changes: 0 additions & 7 deletions packages/snap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,6 @@ export const onRpcRequest = async ({
),
);

console.log('tx.hash', tx.hash);

// TODO: remove due to metamask time-out restriction;
await tx.wait();

console.log('tx', JSON.stringify(tx));

return tx.hash;
} catch (error) {
console.error(error);
Expand Down
2,688 changes: 1,403 additions & 1,285 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit d7ed189

Please sign in to comment.