Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wc 2 #3045

Merged
merged 24 commits into from
Nov 8, 2024
Merged

Wc 2 #3045

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
42a5799
Merge branch 'master' of https://github.com/ecadlabs/taquito
hui-an-yang Jul 26, 2024
e45286c
Merge branch 'master' of https://github.com/ecadlabs/taquito
hui-an-yang Aug 29, 2024
903169d
Merge branch 'master' of https://github.com/ecadlabs/taquito
hui-an-yang Sep 12, 2024
e0cb854
feat: revived @taquiot/wallet-connect-2 package
hui-an-yang Sep 12, 2024
bc60f8b
docs: adding website doc with live code example (modal isn't working …
hui-an-yang Sep 19, 2024
37dd379
feat: has qrcode modal working with @walletconnect/legacy-modal
hui-an-yang Sep 26, 2024
410c28c
feat: fill-in wc2 logic of sing and getPK
hui-an-yang Sep 26, 2024
25d970a
test: added unit test ofr sign and getPK
hui-an-yang Sep 26, 2024
e35c000
Merge branch 'master' of https://github.com/ecadlabs/taquito into HEAD
hui-an-yang Sep 26, 2024
4502753
Merge branch 'wc-2' of https://github.com/ecadlabs/taquito into wc-2
hui-an-yang Oct 10, 2024
902b352
chore: dependencies update to fix vulnerbilities
hui-an-yang Oct 10, 2024
f5fdb00
Merge branch 'master' of https://github.com/ecadlabs/taquito into wc-2
hui-an-yang Oct 17, 2024
303376c
feat: testdapp with walletconnect option
hui-an-yang Oct 25, 2024
c1580f5
feat(wallet connect): sign payload using wc in test-dapp
roxaneletourneau Nov 1, 2024
ced7349
Updated docs
roxaneletourneau Nov 5, 2024
b3d7259
Merge pull request #3074 from ecadlabs/wc-2-test-dapp
roxaneletourneau Nov 5, 2024
94e78d2
Merge branch 'wc-2' of https://github.com/ecadlabs/taquito into wc-2
hui-an-yang Nov 5, 2024
1b993e0
fix: make verifySignatureWithTaquito walletconnect compatiable
hui-an-yang Nov 6, 2024
82bcbd5
fix: resolve not subscribeToEvent ACTIVE_ACCOUNT_SET error in console
hui-an-yang Nov 6, 2024
b207276
fix: added registryUrl to fix console 404 error
hui-an-yang Nov 6, 2024
e3230bf
chore: update dependencies
hui-an-yang Nov 6, 2024
b9c0f1e
refactor: rename from walletconnect2 to walletconnect
hui-an-yang Nov 6, 2024
ed93be8
chore: updated sass to 1.80.1
hui-an-yang Nov 7, 2024
3397c63
docs: added (BETA) to walletconnect package
hui-an-yang Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Taquito is used by **over 80% of DApps** in the Tezos ecosystem. It is easy to u

## Why should I use Taquito?

Taquito provides convenient abstractions for a multitude of common operations, including wallet interactions (with [WalletConnect2](https://docs.walletconnect.com/2.0) in the works), batching operations, calling into contracts, querying the blockchain, and more. Taquito will isolate your code from subtle - and some not-so-subtle - changes made to the underlying Tezos protocol.
Taquito provides convenient abstractions for a multitude of common operations, including wallet interactions (with [WalletConnect/Reown](https://reown.com/) in the works), batching operations, calling into contracts, querying the blockchain, and more. Taquito will isolate your code from subtle - and some not-so-subtle - changes made to the underlying Tezos protocol.

...Not to mention our thriving, helpful, and welcoming community!

Expand Down Expand Up @@ -80,6 +80,8 @@ Taquito is organized as a [monorepo](https://en.wikipedia.org/wiki/Monorepo), an
| [@taquito/contracts-library](packages/taquito-contracts-library) | Provides functionality specify static data related to contracts |
| [@taquito/ledger-signer](packages/taquito-ledger-signer) | Provides functionality for ledger signer provider |
| [@taquito/timelock](packages/taquito-timelock) | Provides functionality to create and open timelocks |
| [@taquito/wallet-connect](packages/taquito-wallet-connect) | WalletConnect class can be injected into the `TezosToolkit` to work with the wallet API. |


## API Documentation

Expand Down
4 changes: 3 additions & 1 deletion apps/taquito-test-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"events": "^3.3.0",
"lerna": "^8.1.7",
"prettier-plugin-svelte": "^3.2.6",
"sass": "^1.78.0",
"sass": "^1.80.1",
"svelte": "^4.2.19",
"svelte-check": "^3.8.5",
"svelte-preprocess": "^6.0.2",
Expand All @@ -30,7 +30,9 @@
"@taquito/core": "^20.1.0",
"@taquito/taquito": "^20.1.0",
"@taquito/utils": "^20.1.0",
"@taquito/wallet-connect": "^20.1.0",
"buffer": "^6.0.3",
"svelte-modals": "^2.0.0-beta.2",
"svelte-select": "^5.8.3",
"vite-compatible-readable-stream": "^3.6.1"
},
Expand Down
53 changes: 39 additions & 14 deletions apps/taquito-test-dapp/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { NetworkType } from "@airgap/beacon-types";
import Select from "svelte-select";
import { getRpcUrl } from "./config";
import store from "./store";
import store, { SDK } from "./store";
import Layout from "./Layout.svelte";
import TestContainer from "./lib/TestContainer.svelte";

Expand All @@ -13,7 +13,6 @@
let browser = "";
let availableNetworks = [
{ value: "ghostnet", label: "Ghostnet", group: "current testnets" },
{ value: "oxfordnet", label: "Oxfordnet", group: "current testnets" },
{ value: "parisnet", label: "Parisnet", group: "current testnets" },
{ value: "mainnet", label: "Mainnet", group: "mainnet" },
{ value: "dailynet", label: "Dailynet", group: "other testnets" },
Expand All @@ -40,9 +39,6 @@
case "ghostnet":
store.updateNetworkType(NetworkType.GHOSTNET);
break;
case "oxfordnet":
store.updateNetworkType(NetworkType.OXFORDNET);
break;
case "parisnet":
store.updateNetworkType(NetworkType.PARISNET);
break;
Expand Down Expand Up @@ -129,6 +125,18 @@
margin: 10px 0px;
}

.sdk {
border: 1px solid;
border-radius: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 20px;
grid-row-gap: 10px;
align-items: center;
width: 100%;
}

button {
width: 100%;
justify-content: center;
Expand Down Expand Up @@ -175,15 +183,32 @@
<div>(use Chrome for a better experience)</div>
{/if}
<div class="options">
<button
on:click={() => {
const wallet = document.getElementById("wallet-button");
wallet?.click();
}}
>
<span class="material-icons-outlined"> account_balance_wallet </span>
&nbsp; Connect your wallet
</button>
<div class="sdk">
<span><strong>Connect using beacon sdk</strong></span>
<button
on:click={() => {
const wallet = document.getElementById("wallet-button");
store.updateSdk(SDK.BEACON);
wallet.click();
}}
>
<span class="material-icons-outlined"> account_balance_wallet </span>
&nbsp; Connect your wallet
</button>
</div>
<div class="sdk">
<span><strong>Connect using Wallet Connect</strong></span>
<button
on:click={() => {
const walletConnect = document.getElementById("wallet-button");
store.updateSdk(SDK.WC2);
walletConnect.click();
}}
>
<span class="material-icons-outlined"> account_balance_wallet </span>
&nbsp; Connect your wallet
</button>
</div>
<button>
<span class="material-icons-outlined"> usb </span>
&nbsp; Connect your Nano ledger
Expand Down
29 changes: 15 additions & 14 deletions apps/taquito-test-dapp/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { NetworkType } from '@airgap/beacon-types';
import { NetworkType as NetworkTypeBeacon } from "@airgap/beacon-sdk";
import { NetworkType as NetworkTypeWc } from "@taquito/wallet-connect";

export type SupportedNetworks = NetworkType.PARISNET | NetworkType.OXFORDNET | NetworkType.GHOSTNET | NetworkType.MAINNET | NetworkType.CUSTOM;
export type SupportedNetworks = NetworkTypeBeacon.MAINNET | NetworkTypeBeacon.GHOSTNET | NetworkTypeBeacon.PARISNET | NetworkTypeWc.MAINNET | NetworkTypeWc.GHOSTNET | NetworkTypeWc.PARISNET | NetworkTypeBeacon.CUSTOM;

const rpcUrls: Record<SupportedNetworks, string> = {
[NetworkType.MAINNET]: "https://mainnet.ecadinfra.com",
[NetworkType.GHOSTNET]: "https://ghostnet.ecadinfra.com/",
[NetworkType.OXFORDNET]: "https://oxfordnet.ecadinfra.com/",
[NetworkType.PARISNET]: "https://rpc.pariscnet.teztnets.com/",
[NetworkType.CUSTOM]: "https://ghostnet.ecadinfra.com/",
[NetworkTypeBeacon.MAINNET]: "https://mainnet.ecadinfra.com",
[NetworkTypeBeacon.GHOSTNET]: "https://ghostnet.ecadinfra.com/",
[NetworkTypeBeacon.PARISNET]: "https://rpc.pariscnet.teztnets.com/",
[NetworkTypeBeacon.CUSTOM]: "https://ghostnet.ecadinfra.com/",
};

export const getRpcUrl = (networkType: SupportedNetworks): string => {
Expand All @@ -16,22 +16,23 @@ export const getRpcUrl = (networkType: SupportedNetworks): string => {

export const getTzKtUrl = (networkType: SupportedNetworks): string | undefined => {
switch (networkType) {
case NetworkType.MAINNET:
case NetworkTypeBeacon.MAINNET:
case NetworkTypeWc.MAINNET:
return "https://tzkt.io";
case NetworkType.GHOSTNET:
case NetworkTypeBeacon.GHOSTNET:
case NetworkTypeWc.GHOSTNET:
return "https://ghostnet.tzkt.io";
case NetworkType.OXFORDNET:
return "https://oxfordnet.tzkt.io";
case NetworkType.PARISNET:
case NetworkTypeBeacon.PARISNET:
case NetworkTypeWc.PARISNET:
return "https://parisnet.tzkt.io";
case NetworkType.CUSTOM:
case NetworkTypeBeacon.CUSTOM:
return undefined;
}
}

export const defaultMatrixNode = "beacon-node-1.sky.papers.tech";

export const defaultNetworkType = NetworkType.GHOSTNET;
export const defaultNetworkType = NetworkTypeBeacon.GHOSTNET;

// new protocol updated rpc url in example/data/test-dapp-contract.ts and npm -w example run example:deploy-dapp
export const contractAddress = {
Expand Down
79 changes: 79 additions & 0 deletions apps/taquito-test-dapp/src/lib/ModalActivePairing.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<script>
import { createModalEventDispatcher } from "svelte-modals";

export let isOpen;
export let title;
export let options;

const dispatch = createModalEventDispatcher();
</script>

<style>
.modal {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
color: black;

/* allow click-through to backdrop */
pointer-events: none;
}

.contents {
min-width: 240px;
border-radius: 6px;
padding: 16px;
background: white;
display: flex;
flex-direction: column;
justify-content: space-between;
pointer-events: auto;
}
.button {
color: black;
border-color: black;
}

h2 {
text-align: center;
font-size: 24px;
}

p {
text-align: center;
margin-top: 16px;
}

.actions {
margin-top: 32px;
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 8px;
}
</style>

{#if isOpen}
<div role="dialog" class="modal">
<div class="contents">
<h2>{title}</h2>
<div class="actions">
{#each options as option}
<button class="button" on:click={() => dispatch("select", option)}>
{option.peerMetadata.logo ?? ""}
{option.peerMetadata.name}
</button>
{/each}
<p>or</p>
<button class="button" on:click={() => dispatch("select", "new_pairing")}
>New Pairing</button
>
</div>
</div>
</div>
{/if}
44 changes: 38 additions & 6 deletions apps/taquito-test-dapp/src/lib/TestContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@
import { shortenHash } from "../utils";
import { NetworkType } from "@airgap/beacon-types";
import { getTzKtUrl } from "../config";
import { BeaconWallet } from "@taquito/beacon-wallet";

let test: TestSettings | undefined;
let executionTime = 0;
let loading = false;
let success: boolean | undefined;
let opHash = "";
let input = { text: "", fee: 400, storageLimit: 400, gasLimit: 1320, amount: 0, address: "", delegate: "", stake: 0, unstake: 0 };
let input = {
text: "",
fee: 400,
storageLimit: 400,
gasLimit: 1320,
amount: 0,
address: "",
delegate: "",
stake: 0,
unstake: 0,
};
let testResult: { id: string; title: string; body: any };
let error: Error | undefined;

const run = async () => {
success = undefined;
Expand Down Expand Up @@ -68,9 +80,18 @@
title: "Confirmations through observable",
body: result.confirmationObsOutput,
};
} else if (test.id === "show-public-key") {
testResult = {
id: test.id,
title: "Public Key",
body: {
output: result.output
}
}
}
} else {
throw "Error";
error = result.error;
throw result.error;
}
} catch (error) {
console.log(error);
Expand All @@ -82,7 +103,9 @@
};

const switchAccount = async () => {
await $store.wallet.clearActiveAccount();
if ($store.wallet instanceof BeaconWallet) {
await $store.wallet.clearActiveAccount();
}
store.updateUserAddress(undefined);
store.updateUserBalance(undefined);
store.updateWallet(undefined);
Expand Down Expand Up @@ -306,21 +329,21 @@
bind:value={input.text}
/>
</div>
{:else if test.inputRequired && test.inputType === "delegate"}
{:else if test.inputRequired && test.inputType === "delegate"}
<div class="test-input set-delegate">
<label for="delegate-address">
<span>Delegate address</span>
<input type="delegate" id="delegate-address" bind:value={input.delegate} />
</label>
</div>
{:else if test.inputRequired && test.inputType === "stake"}
{:else if test.inputRequired && test.inputType === "stake"}
<div class="test-input stake">
<label for="stake-amount">
<span>Stake amount</span>
<input type="stake" id="stake-amount" bind:value={input.stake} />
</label>
</div>
{:else if test.inputRequired && test.inputType === "unstake"}
{:else if test.inputRequired && test.inputType === "unstake"}
<div class="test-input unstake">
<label for="unstake-amount">
<span>Unstake amount</span>
Expand Down Expand Up @@ -392,6 +415,15 @@
<h4>
Test failed <span class="material-icons-outlined"> sentiment_very_dissatisfied </span>
</h4>
{#if error}
<div style="word-break:break-word; color:#b92a2a">
{#if error instanceof Error}
{error}
{:else}
{JSON.stringify(error)}
{/if}
</div>
{/if}
</div>
{/if}
<div class="test-run">
Expand Down
Loading
Loading