Skip to content

Commit

Permalink
Merge pull request #96 from thencc/main
Browse files Browse the repository at this point in the history
pkg upgrades (notably aw w mobx)
  • Loading branch information
youraerials authored Jul 2, 2024
2 parents 3c2f246 + aab54d4 commit 8c4ef93
Show file tree
Hide file tree
Showing 86 changed files with 12,123 additions and 8,204 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ algonaut is optimized for inkey! on the top level of algonaut there are useful m

You can subscribe to account changes like so:
```ts
import { subscribeToAccountChanges } from '@thencc/algonautjs';
import {
Algonaut
} from '@thencc/algonautjs';

const algonaut = new Algonaut();

const unsubscribe = subscribeToAccountChanges(
const unsubscribe = algonaut.subscribeToAccountChanges(
(acct) => {
if (acct) {
// authenticated
Expand All @@ -211,14 +215,26 @@ unsubscribe();


<details open>
<summary><h3>🔋 ex: reconnect ↕</h3></summary>
<summary><h3>🔋 ex: recall state / reconnect ↕</h3></summary>

if your dapp wants to recall previously connected accounts from localstorage, it is recommended to call this on page load:
if your dapp wants to recall previously connected accounts from localstorage, use the same `storageKey` during intialization
```ts
algonaut.reconnect();
// IF connected during a previous session... the active account + connected accounts are now populated
console.log(algonaut.connectedAccounts);
console.log(algonaut.account);
import {
Algonaut
} from '@thencc/algonautjs';

const algonautA = new Algonaut({
storageKey: 'state1'
});
const algonautB = new Algonaut({
storageKey: 'state1'
});

// now, algonautA.activeAddress == algonautB.activeAddress

// and if a user connected accounts during a previous session, the active account + connected accounts are now populated
console.log(algonautA.connectedAccounts);
console.log(algonautA.account);
```
</details>

Expand Down
8 changes: 4 additions & 4 deletions dist/AlgonautTypes.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { LogicSigAccount, Transaction, SuggestedParams, MultisigMetadata } from 'algosdk';
import type { ApplicationStateSchema } from 'algosdk/dist/types/client/v2/algod/models/types';
import type { WalletInitParamsObj } from '@thencc/any-wallet';
import type { AnyWalletStateConfig, WalletInitParamsObj } from '@thencc/any-wallet';
export type AlgonautConfig = {
libConfig?: {
disableLogs?: boolean;
};
nodeConfig?: {
BASE_SERVER: string;
INDEX_SERVER?: string;
LEDGER: string;
PORT: string;
API_TOKEN: any;
};
disableLogs?: boolean;
initWallets?: WalletInitParamsObj;
storageKey?: AnyWalletStateConfig['storageKey'];
storageController?: AnyWalletStateConfig['storageController'];
};
export interface AlgonautStateData {
key: string;
Expand Down
5 changes: 3 additions & 2 deletions dist/constants.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import type { AlgonautConfig } from './AlgonautTypes';
export declare const defaultLibConfig: AlgonautConfig['libConfig'];
export declare const defaultLibConfig: {
disableLogs: boolean;
};
74 changes: 32 additions & 42 deletions dist/index.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.cjs.map

Large diffs are not rendered by default.

Loading

0 comments on commit 8c4ef93

Please sign in to comment.