Skip to content

Commit

Permalink
Merge pull request #77 from perawallet/next-release
Browse files Browse the repository at this point in the history
  • Loading branch information
mucahit authored Nov 23, 2022
2 parents 6178a70 + 894800e commit 9bf1ec5
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 11 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ try {
## Options
| option | default | value | |
| --------- | --------- | ------------------------------------- | -------- |
| `network` | `mainnet` | `dev`, `testnet`, `mainnet` | optional |
| `chainId` | `4160` | `416001`, `416002`, `416003` , `4160` | optional |
| option | default | value | |
| ------------------------ | --------- | ------------------------------------- | -------- |
| `network` | `mainnet` | `dev`, `testnet`, `mainnet` | optional |
| `chainId` | `4160` | `416001`, `416002`, `416003` , `4160` | optional |
| `shouldShowSignTxnToast` | `true` | `boolean` | optional |
#### **`network`**
Expand All @@ -109,6 +110,12 @@ Determines which Algorand network your dApp uses.
**All Networks**: 4160
#### **`shouldShowSignTxnToast`**
<img width="422" alt="Group 48096937" src="https://user-images.githubusercontent.com/54077855/202682828-9ac57b62-58c1-4a83-af3b-e1b7ffad2d89.png">
It's enabled by default but in some cases, you may not need the toast message (e.g. you already have signing guidance for users). To disable it, use the shouldShowSignTxnToast option:
## Methods
#### `PeraWalletConnect.connect(): Promise<string[]>`
Expand Down Expand Up @@ -140,7 +147,7 @@ Starts the sign process and returns the signed transaction in `Uint8Array`
You can override the z-index using the `.pera-wallet-connect-modal` class so that the modal does not conflict with another component on your application.
```scss
.pera-wallet-connect-modal {
.pera-wallet-modal {
// The default value of z-index is 10. You can lower and raise it as much as you want.
z-index: 11;
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.3",
"version": "1.0.4",
"name": "@perawallet/connect",
"description": "JavaScript SDK for integrating Pera Wallet to web applications.",
"main": "dist/index.js",
Expand Down
24 changes: 21 additions & 3 deletions src/PeraWalletConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,12 @@ class PeraWalletConnect {

resolve(this.connector?.accounts || []);
}

// ================================================= //

// If there is no wallet details in storage, resolve the promise with empty array
if (!this.isConnected) {
resolve([]);
}
} catch (error: any) {
// If the bridge is not active, then disconnect
await this.disconnect();
Expand Down Expand Up @@ -638,7 +642,8 @@ class PeraWalletConnect {
},

origin: generateEmbeddedWalletURL(webWalletURLs.TRANSACTION_SIGN),
targetWindow: peraWalletIframe.contentWindow
targetWindow: peraWalletIframe.contentWindow,
timeout: 3000
});
}

Expand All @@ -662,7 +667,8 @@ class PeraWalletConnect {
},

origin: webWalletURLs.TRANSACTION_SIGN,
targetWindow: newPeraWalletTab
targetWindow: newPeraWalletTab,
timeout: 3000
});
}
})
Expand Down Expand Up @@ -772,6 +778,18 @@ class PeraWalletConnect {
txnRequestParams.signers = signers;
}

if (txGroupDetail.authAddr) {
txnRequestParams.authAddr = txGroupDetail.authAddr;
}

if (txGroupDetail.message) {
txnRequestParams.message = txGroupDetail.message;
}

if (txGroupDetail.msig) {
txnRequestParams.msig = txGroupDetail.msig;
}

return txnRequestParams;
})
);
Expand Down
17 changes: 17 additions & 0 deletions src/util/model/peraWalletModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,29 @@ import {Transaction} from "algosdk";

export interface SignerTransaction {
txn: Transaction;

/**
* Optional authorized address used to sign the transaction when
* the account is rekeyed. Also called the signor/sgnr.
*/
authAddr?: string;

/**
* Optional multisig metadata used to sign the transaction
*/
msig?: PeraWalletMultisigMetadata;

/**
* Optional list of addresses that must sign the transactions.
* Wallet skips to sign this txn if signers is empty array.
* If undefined, wallet tries to sign it.
*/
signers?: string[];

/**
* Optional message explaining the reason of the transaction
*/
message?: string;
}

/**
Expand Down

0 comments on commit 9bf1ec5

Please sign in to comment.