Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from mich3lang3lo/main
Browse files Browse the repository at this point in the history
feat: new pallad provider methdos
  • Loading branch information
mrcnk authored Apr 20, 2024
2 parents c2b3928 + bbb6579 commit acd8b8b
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,58 @@
// nothing to write in the app
// since it is writing to Pallad
};
const requestNetwork = async () => {
const response = await window.mina.request({
method: "mina_requestNetwork"
});
console.log('requestNetwork response', response)
results.set({
...$results,
requestNetworkResponse: response.result,
});
};
const addChain = async () => {
const response = await window.mina.request({
method: "mina_addChain",
params: {
nodeEndpoint: {
providerName: 'mina-node',
url: 'https://proxy.minaexplorer.com/graphql'
},
archiveNodeEndpoint: {
providerName: 'mina-node',
url: 'https://graphql.minaexplorer.com'
},
networkName: 'Mainnet',
networkType: 'mainnet',
chainId: '...'
}
});
console.log('addChain response', response)
results.set({
...$results,
addChainResponse: response.result,
});
}
const switchChain = async () => {
//const berkeleyChainId = 'fd7d111973bf5a9e3e87384f560fdead2f272589ca00b6d9e357fca9839631da'
const mainnetChainId = '5f704cc0c82e0ed70e873f0893d7e06f148524e3f0bdae2afb02e7819a0c24d1'
const response = await window.mina.request({
method: "mina_switchChain",
params: {
chainId: mainnetChainId
}
});
console.log('switchChain response', response)
results.set({
...$results,
switchChainResponse: response.result,
});
};
export const results = writable({
accounts: "",
chainId: "",
Expand All @@ -124,6 +176,9 @@
signMessage: "",
signTransactions: "",
credential: "",
addChainResponse: "",
switchChainResponse: "",
requestNetworkResponse: ""
});
</script>

Expand Down Expand Up @@ -190,6 +245,27 @@
<button class="btn btn-neutral flex-1" on:click={getBalance}
>mina_getBalance</button
>
<input
class="input input-bordered"
value={$results.requestNetworkResponse}
/>
<button class="btn btn-neutral flex-1" on:click={requestNetwork}
>mina_requestNetwork</button
>
<input
class="input input-bordered"
value={$results.addChainResponse}
/>
<button class="btn btn-neutral flex-1" on:click={addChain}
>mina_addChain</button
>
<input
class="input input-bordered"
value={$results.switchChainResponse}
/>
<button class="btn btn-neutral flex-1" on:click={switchChain}
>mina_switchChain</button
>
</div>
</div>
</div>
Expand Down

0 comments on commit acd8b8b

Please sign in to comment.