Skip to content

Commit

Permalink
fix: add avm web provider to use wallet (#33)
Browse files Browse the repository at this point in the history
* build: lower node required version to 18.20.3 in order to match use-wallet's version

* build: use one minified file for bundled code

* docs: add throwing an error documentation

* ci: update the release to add use the new bundle
  • Loading branch information
kieranroneill authored May 30, 2024
1 parent 595e369 commit b4c13ae
Show file tree
Hide file tree
Showing 11 changed files with 404 additions and 267 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: "🏗️ Build"
run: yarn docs:build

build_pakage:
build_package:
name: "Build Package"
needs: install
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@semantic-release/github",
{
"assets": [
{ "label": "avm-web-client.min.js" ,"path": "dist/avm-web-client.min.js" },
{ "label": "avm-web-provider.min.js" ,"path": "dist/avm-web-provider.min.js" }
],
"releasedLabels": ["🚀 released"]
Expand Down
274 changes: 137 additions & 137 deletions docs/clients/disabling-a-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,56 +27,56 @@ Assuming a client has been [enabled](enabling-a-client) with one or all provider
]}>
<TabItem value="javascript">

```js
// initialized client
client.onDisable(({ error, result }) => {
if (error) {
console.error('error:', error);

return;
}

console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});

// send a disable request
client.disable();
```
```js
// initialized client
client.onDisable(({ error, result }) => {
if (error) {
console.error('error:', error);

return;
}

console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});

// send a disable request
client.disable();
```

</TabItem>
<TabItem value="typescript">

```typescript
import { IAVMWebClientCallbackOptions } from '@agoralabs-sh/avm-web-provider';
```typescript
import { IAVMWebClientCallbackOptions } from '@agoralabs-sh/avm-web-provider';
// initialized client
client.onDisable(({ error, result }: IAVMWebClientCallbackOptions) => {
if (error) {
console.error('error:', error);
// initialized client
client.onDisable(({ error, result }: IAVMWebClientCallbackOptions) => {
if (error) {
console.error('error:', error);
return;
}
return;
}
console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});
console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});
// send a disable request
client.disable();
```
// send a disable request
client.disable();
```

</TabItem>
</Tabs>
Expand All @@ -99,63 +99,63 @@ If you want to target a specific provider and network, you can simply pass the I
]}>
<TabItem value="javascript">

```js
// initialized client
client.onDisable(({ error, result }) => {
if (error) {
console.error('error:', error);

return;
}

console.log(result);
/*
```js
// initialized client
client.onDisable(({ error, result }) => {
if (error) {
console.error('error:', error);
return;
}
console.log(result);
/*
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});
// send a disable request
client.disable({
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});

// send a disable request
client.disable({
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
});
```
});
```

</TabItem>
<TabItem value="typescript">

```typescript
import { IAVMWebClientCallbackOptions } from '@agoralabs-sh/avm-web-provider';
```typescript
import { IAVMWebClientCallbackOptions } from '@agoralabs-sh/avm-web-provider';
const providerId: string = '02657eaf-be17-4efc-b0a4-19d654b2448e';
const providerId: string = '02657eaf-be17-4efc-b0a4-19d654b2448e';
// initialized client
client.onEnable(({ error, result }: IAVMWebClientCallbackOptions) => {
if (error) {
console.error('error:', error);
// initialized client
client.onDisable(({ error, result }: IAVMWebClientCallbackOptions) => {
if (error) {
console.error('error:', error);
return;
}
return;
}
console.log(result);
/*
{
console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});
// send a disable request
client.disable({
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
}
*/
});
// send a disable request
client.disable({
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
});
```
});
```

</TabItem>
</Tabs>
Expand All @@ -178,62 +178,62 @@ If you want to remove a specific session, you can provide the session ID(s) in t
]}>
<TabItem value="javascript">

```js
// initialized client
client.onDisable(({ error, result }) => {
if (error) {
console.error('error:', error);
return;
}
console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
```js
// initialized client
client.onDisable(({ error, result }) => {
if (error) {
console.error('error:', error);
return;
}
console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
sessionIds: ['ab192498-0c63-4028-80fd-f148710611d8'],
}
*/
});
// send a disable request
client.disable({
sessionIds: ['ab192498-0c63-4028-80fd-f148710611d8'],
}
*/
});
// send a disable request
client.disable({
sessionIds: ['ab192498-0c63-4028-80fd-f148710611d8'],
});
```
});
```

</TabItem>
<TabItem value="typescript">

```typescript
import { IAVMWebClientCallbackOptions } from '@agoralabs-sh/avm-web-provider';
// initialized client
client.onEnable(({ error, result }: IAVMWebClientCallbackOptions) => {
if (error) {
console.error('error:', error);
return;
}
console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
```typescript
import { IAVMWebClientCallbackOptions } from '@agoralabs-sh/avm-web-provider';
// initialized client
client.onDisable(({ error, result }: IAVMWebClientCallbackOptions) => {
if (error) {
console.error('error:', error);
return;
}
console.log(result);
/*
{
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
genesisId: 'testnet-v1.0',
providerId: '02657eaf-be17-4efc-b0a4-19d654b2448e',
sessionIds: ['ab192498-0c63-4028-80fd-f148710611d8'],
}
*/
});
// send a disable request
client.disable({
sessionIds: ['ab192498-0c63-4028-80fd-f148710611d8'],
}
*/
});
// send a disable request
client.disable({
sessionIds: ['ab192498-0c63-4028-80fd-f148710611d8'],
});
```
});
```

</TabItem>
</Tabs>
4 changes: 2 additions & 2 deletions docs/clients/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Include the minified browser bundle directly in your HTML like so:
```html
<html>
...
<script src="https://github.com/agoralabs-sh/avm-web-provider/releases/latest/download/avm-web-client.min.js"></script>
<script src="https://github.com/agoralabs-sh/avm-web-provider/releases/latest/download/avm-web-provider.min.js"></script>
...
</html>
```
Expand Down Expand Up @@ -54,7 +54,7 @@ Firstly, we want to initialize the AVM web client:
<TabItem value="javascript-via-cdn">

```js
var client = AVMWebClient.init('02657eaf-be17-4efc-b0a4-19d654b2448e');
var client = window.AVMWebProviderSDK.AVMWebClient.init();
```

</TabItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/providers/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Firstly, we want to initialize the AVM web provider with an ID:
<TabItem value="javascript-via-cdn">

```js
var provider = AVMWebProvider.init('02657eaf-be17-4efc-b0a4-19d654b2448e');
var provider = window.AVMWebProviderSDK.AVMWebProvider.init();
```

</TabItem>
Expand Down
1 change: 1 addition & 0 deletions docs/providers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
* [Responding To Post Transactions Requests](providers/responding-to-post-transactions-requests)
* [Responding To Sign And Post Transactions Requests](providers/responding-to-sign-and-post-transactions-requests)
* [Responding To Sign Message Requests](providers/responding-to-sign-message-requests)
* [Throwing An Error](providers/throwing-an-error)
Loading

0 comments on commit b4c13ae

Please sign in to comment.