Skip to content

Commit

Permalink
v17.5.0: add accepted to World App
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Oct 10, 2024
1 parent 27b73b9 commit 8317ce3
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 13 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,13 @@ await wallet.switchTo('bsc')

### Data Structure

`accepted: Function ()=>{}`: Callback that will be executed once the transaction has been accepted by the wallet but not sent to the network yet (e.g. relayer, World App). Has no transaction yet, as only sent can contain the transaction.

`api: Array`: Api of the contract (e.g. abi for Ethereum, Layout/Struct for Solana).

`blockchain: String`: Name of the blockchain e.g. 'ethereum'.

`failed: Function (transaction, error)=>{}`: Callback to be executed if transaction failed (e.g. reverted).
`failed: Function (transaction, error)=>{}`: Callback that will be executed once the transaction failed onchain (reverted).

`from: String`: Address of the transaction sender.

Expand All @@ -242,9 +244,9 @@ await wallet.switchTo('bsc')

`params: Object or Array`: Parameters passed to the method (EVM).

`sent: Function (transaction)=>{}`: Callback to be executed if transaction has been sent to the network.
`sent: Function (transaction)=>{}`: Callback that will be executed executed once the transaction has been sent to the network.

`succeeded: Function (transaction)=>{}`: Callback to be executed if transaction was successful and has been confirmed once by the network.
`succeeded: Function (transaction)=>{}`: Callback that will be executed once the transaction was successful and has been confirmed at least once by the network.

`to String`: Address of the contract to be transacted with (EVM).

Expand Down
7 changes: 6 additions & 1 deletion dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Transaction {
alts,
sent,
succeeded,
failed
failed,
accepted,
}) {

// required
Expand All @@ -38,6 +39,7 @@ class Transaction {
this.api = api;
this.method = method;
this.params = params;
this.accepted = accepted;
this.sent = sent;
this.succeeded = succeeded;
this.failed = failed;
Expand Down Expand Up @@ -1651,6 +1653,9 @@ class WorldApp {
MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, (payload)=> {
console.log('payload', payload);
if (payload.status == "success") {
console.log('before transaction.accepted', transaction);
if (transaction.accepted) { transaction.accepted(); }
console.log('after transaction.accepted', transaction);
this.fetchTransaction(transaction, payload).then((transactionHash)=>{
if(transactionHash) {
resolve(transaction);
Expand Down
7 changes: 6 additions & 1 deletion dist/esm/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/esm/index.solana.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion dist/umd/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
alts,
sent,
succeeded,
failed
failed,
accepted,
}) {

// required
Expand All @@ -41,6 +42,7 @@
this.api = api;
this.method = method;
this.params = params;
this.accepted = accepted;
this.sent = sent;
this.succeeded = succeeded;
this.failed = failed;
Expand Down Expand Up @@ -1654,6 +1656,9 @@
worldcoinPrecompiled.MiniKit.subscribe(worldcoinPrecompiled.ResponseEvent.MiniAppSendTransaction, (payload)=> {
console.log('payload', payload);
if (payload.status == "success") {
console.log('before transaction.accepted', transaction);
if (transaction.accepted) { transaction.accepted(); }
console.log('after transaction.accepted', transaction);
this.fetchTransaction(transaction, payload).then((transactionHash)=>{
if(transactionHash) {
resolve(transaction);
Expand Down
7 changes: 6 additions & 1 deletion dist/umd/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/umd/index.solana.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-wallets-evm",
"moduleName": "Web3Wallets",
"version": "17.4.8",
"version": "17.5.0",
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
"main": "dist/umd/index.evm.js",
"module": "dist/esm/index.evm.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-wallets",
"moduleName": "Web3Wallets",
"version": "17.4.8",
"version": "17.5.0",
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
"main": "dist/umd/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion package.solana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-wallets-solana",
"moduleName": "Web3Wallets",
"version": "17.4.8",
"version": "17.5.0",
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
"main": "dist/umd/index.solana.js",
"module": "dist/esm/index.solana.js",
Expand Down
4 changes: 3 additions & 1 deletion src/Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class Transaction {
alts,
sent,
succeeded,
failed
failed,
accepted,
}) {

// required
Expand All @@ -29,6 +30,7 @@ class Transaction {
this.api = api
this.method = method
this.params = params
this.accepted = accepted
this.sent = sent
this.succeeded = succeeded
this.failed = failed
Expand Down
3 changes: 3 additions & 0 deletions src/wallets/WorldApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export default class WorldApp {
MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, (payload)=> {
console.log('payload', payload)
if (payload.status == "success") {
console.log('before transaction.accepted', transaction)
if (transaction.accepted) { transaction.accepted() }
console.log('after transaction.accepted', transaction)
this.fetchTransaction(transaction, payload).then((transactionHash)=>{
if(transactionHash) {
resolve(transaction)
Expand Down

0 comments on commit 8317ce3

Please sign in to comment.