Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bako sign message #390

Draft
wants to merge 107 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
47ed191
fix
guimroque Mar 19, 2024
39f6324
feat(connector): bako safe
guimroque Mar 20, 2024
3e33666
fix(packages): remove not used packages and remove peerDependencies
guimroque Mar 22, 2024
ac600d3
fix(consts): add url to bako safe api using domain .bako.global
guimroque Mar 22, 2024
42771b8
fix(types): use typer imported of fuel
guimroque Mar 22, 2024
352647c
feat(networks): implement method
guimroque Mar 22, 2024
c602928
fix(logo): use logo by bako.global domain
guimroque Mar 26, 2024
86e143f
fix(disconnect): validate valid connection by verification on socket …
guimroque Mar 26, 2024
0e16be5
fix(packages): fixed version
guimroque Mar 26, 2024
4d2d123
fix(packages): fixed version
guimroque Mar 26, 2024
e4500b1
chore(): get infra updated changes
guimroque Mar 26, 2024
f0a3fa7
merge
guimroque Mar 27, 2024
38132f4
fix: packages
guimroque Mar 27, 2024
70351cb
fix: remove axios and use fetch
guimroque Mar 27, 2024
fed88a6
fix: remove axios to use fetch and use fuel storageAbstract
guimroque Mar 28, 2024
3230f5e
chore: changeset
guimroque Mar 28, 2024
fe25745
fix: connection popup closing
guimroque Mar 29, 2024
fb71de8
chore: pull main updates
guimroque Mar 29, 2024
3dc7aea
chore: merge connector ui
guimroque Apr 3, 2024
2c06894
chore: merge main
guimroque Apr 3, 2024
1e5cbb7
Merge branch 'main' of github.com:FuelLabs/fuel-connectors into gr/fe…
guimroque Apr 3, 2024
9d830e8
fix: return an error with window of transaction has closed
guimroque Apr 4, 2024
3470c03
fix: move local events emit set to setup
guimroque Apr 4, 2024
6170de5
fix: verify if event has origin on bako server
guimroque Apr 4, 2024
a9fc075
chore: pull main
guimroque Apr 4, 2024
d5369cc
Merge branch 'main' of github.com:FuelLabs/fuel-connectors into gr/fe…
guimroque Apr 10, 2024
37ea5af
fix: transaction and call contract request
guimroque Apr 10, 2024
e3554dc
wip: socket
guimroque Apr 17, 2024
4b17500
wip: safari
guimroque Apr 19, 2024
86d2050
wip: ping method and message control by id
guimroque Apr 24, 2024
002d12c
feat: reject connect by closed window
guimroque Apr 25, 2024
bbadddc
chore: background with modal on safari
guimroque Apr 25, 2024
acb8933
wip: change async function to promise
guimroque Apr 25, 2024
8800598
wip: socket
guimroque Apr 28, 2024
db12191
wip: validations
guimroque Apr 29, 2024
15e70f3
chore: window naem
guimroque Apr 29, 2024
9693d2e
fix: bako connector name
guimroque Apr 30, 2024
24b2bdc
wip: login with safari
guimroque Apr 30, 2024
4a7f707
wip: login with safari
guimroque Apr 30, 2024
0f86ac3
chore: pull
guimroque May 28, 2024
e28edf6
fix: build
guimroque Jun 4, 2024
7bfc23d
chore: name
guimroque Jun 4, 2024
8538c4a
Merge branch 'main' of github.com:FuelLabs/fuel-connectors into gr/fe…
guimroque Jun 4, 2024
34e78a4
fix: ts config
guimroque Jun 4, 2024
a9c9100
fix: ts config
guimroque Jun 4, 2024
70c6014
fix: ts config
guimroque Jun 4, 2024
3bd609d
fix: add bako-connector to ui
guimroque Jun 4, 2024
3d12207
fix: add bako-connector to ui
guimroque Jun 4, 2024
ca1ceff
refactor: types
guimroque Jun 4, 2024
e9ff1ec
refactor: types
guimroque Jun 4, 2024
0fced56
feat: close frame with backdrop click
guimroque Jun 4, 2024
6395451
chore: staging urls
guimroque Jun 4, 2024
0a6f5fa
fix: lint
guimroque Jun 5, 2024
2f3a8ed
tests: add tests to validate instance bakosafe class
guimroque Jun 5, 2024
af12fa7
fix: popup heigth
guimroque Jun 6, 2024
f085959
fix: move urls to prod
guimroque Jun 6, 2024
cc4a1dd
fix: bakostorage
guimroque Jun 6, 2024
37ceef5
tests: complement
guimroque Jun 6, 2024
520bf6d
tests: add more tests
guimroque Jun 6, 2024
4c49700
tests: add more
guimroque Jun 7, 2024
bf1e388
chore: remove unused imports
guimroque Jun 7, 2024
8d5ef46
Merge branch 'main' into gr/feat/bakosafe
LuizAsFight Jun 10, 2024
238798c
fix: remove evm of default connectors
guimroque Jun 10, 2024
e764a5c
fix: remove evm export
guimroque Jun 10, 2024
229f580
chore: revert identation change
guimroque Jun 10, 2024
b4b31a3
chore: revert identation change
guimroque Jun 10, 2024
db397a0
chore: revert identation change
guimroque Jun 10, 2024
5f837ee
chore: remove unused import
guimroque Jun 10, 2024
2b193a9
chore: remove comments
guimroque Jun 10, 2024
d36578c
chore: remove redundant config
guimroque Jun 10, 2024
054d7fc
chore: pnpm lock
guimroque Jun 11, 2024
595ef1a
Merge pull request #2 from guimroque/gr/feat/bakosafe
guimroque Jun 11, 2024
7c3cb52
chore: sync
guimroque Jun 17, 2024
934a5d0
Merge pull request #3 from guimroque/gr/feat/bakosafe
guimroque Jun 17, 2024
d69e4d9
fix: mobile popup open
guimroque Jun 17, 2024
aef5eb0
Merge branch 'FuelLabs:main' into main
guimroque Jun 20, 2024
7995de8
chore: add bakosafe to default connectors
guimroque Jun 20, 2024
6d66ae8
fix: scroll on open frame in mobile
guimroque Jun 20, 2024
7a317c9
fix: remove duplicated bakosafe
guimroque Jun 20, 2024
26778cc
chore: new api url
guimroque Jun 25, 2024
218af84
Merge branch 'main' into main
guimroque Jun 25, 2024
165dec9
Merge branch 'main' into main
LuizAsFight Jun 28, 2024
147443e
chore: changeset
guimroque Jun 28, 2024
6b508c0
chore: changeset
guimroque Jun 28, 2024
e993520
chore: changeset
guimroque Jun 28, 2024
a06a853
chore: bakosafe icon
guimroque Jul 9, 2024
140e211
Merge branch 'FuelLabs:main' into main
guimroque Jul 9, 2024
1fc4d14
fix: reset changetset
guimroque Jul 9, 2024
5b30347
Merge branch 'main' into main
LuizAsFight Jul 11, 2024
0aa32fd
Merge branch 'FuelLabs:main' into main
guimroque Oct 14, 2024
d21bc3d
feat: sign message
guimroque Oct 14, 2024
b43d17e
fix: validation
guimroque Oct 14, 2024
d148aca
chore: fix conflict
guimroque Oct 14, 2024
60f9517
Update packages/bako-safe/src/BakoSafeConnector.ts
guimroque Oct 14, 2024
59aace8
Update packages/bako-safe/src/BakoSafeConnector.ts
guimroque Oct 14, 2024
aec1e23
chore: remove unnecessary comment
guimroque Oct 14, 2024
7a5c3f3
Merge branch 'gr/feat/bako-sign-message' of github.com:guimroque/fuel…
guimroque Oct 14, 2024
f7e6998
Merge branch 'main' into gr/feat/bako-sign-message
LuizAsFight Oct 14, 2024
aa6e006
Update itchy-news-serve.md
LuizAsFight Oct 14, 2024
7a014cc
Delete .changeset/khaki-crabs-hear.md
LuizAsFight Oct 14, 2024
10f57ec
Update pr-release.yaml
LuizAsFight Oct 14, 2024
321ab5d
chore: sign page url
guimroque Oct 14, 2024
7f8322f
Merge branch 'gr/feat/bako-sign-message' of github.com:guimroque/fuel…
guimroque Oct 14, 2024
74312c8
chore: add message to reject sign
guimroque Oct 14, 2024
6303d72
chore: reject with error
guimroque Oct 14, 2024
2838b11
Update .changeset/itchy-news-serve.md
guimroque Oct 14, 2024
48d29e2
fix: sign message test
guimroque Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/itchy-news-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-connectors/bako-safe": patch
---

feat: bako sign message
4 changes: 2 additions & 2 deletions .github/workflows/pr-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
release-pr:
name: 'Release PR to npm'
runs-on: buildjet-4vcpu-ubuntu-2204
# Comment if:false to enable release PR to npm
# comment out if:false to enable release PR to npm
# if: false
permissions: write-all
steps:
Expand Down Expand Up @@ -47,4 +47,4 @@ jobs:
message: |
This PR is published in NPM with version **${{ steps.release.outputs.published_version }}**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 33 additions & 5 deletions packages/bako-safe/src/BakoSafeConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
APP_VERSION,
HAS_WINDOW,
HOST_URL,
IS_SAFARI,
SESSION_ID,
WINDOW,
} from './constants';
Expand All @@ -47,7 +48,7 @@ export class BakoSafeConnector extends FuelConnector {
description: APP_DESCRIPTION,
},
};
installed = true;
installed = !IS_SAFARI;
connected = false;
external = false;

Expand Down Expand Up @@ -165,7 +166,7 @@ export class BakoSafeConnector extends FuelConnector {
// @ts-ignore
this.on(BakoSafeConnectorEvents.CLIENT_DISCONNECTED, () => {
this.dAppWindow?.close();
reject(false);
reject(new Error('User rejected the request'));
});

this.on(
Expand Down Expand Up @@ -209,7 +210,7 @@ export class BakoSafeConnector extends FuelConnector {
BakoSafeConnectorEvents.CLIENT_DISCONNECTED,
() => {
this.dAppWindow?.close();
reject();
reject(new Error('User rejected the request'));
},
);

Expand All @@ -231,14 +232,16 @@ export class BakoSafeConnector extends FuelConnector {
// @ts-ignore
BakoSafeConnectorEvents.TX_CONFIRMED,
({ data }: { data: IResponseTxCofirmed }) => {
this.dAppWindow?.close();
resolve(`0x${data.id}`);
},
);
});
}

async ping() {
if (IS_SAFARI) {
return false;
}
await this.setup();
return this.setupReady ?? false;
}
Expand Down Expand Up @@ -307,7 +310,32 @@ export class BakoSafeConnector extends FuelConnector {
}

async signMessage(_address: string, _message: string): Promise<string> {
throw new Error('Method not implemented.');
return new Promise<string>((resolve, reject) => {
// window control
this.dAppWindow?.open(`/dapp/sign/${_message}`, reject);
this.checkWindow();

// events control
this.on(
//@ts-ignore
BakoSafeConnectorEvents.CLIENT_DISCONNECTED,
() => {
this.dAppWindow?.close();
reject(new Error('User rejected the request'));
},
);

this.on(
//@ts-ignore
BakoSafeConnectorEvents.SIGN_CONFIRMED,
(data: { data: { signedMessage: string }; from: string }) => {
const signedMessage = data?.data?.signedMessage || '';

this.dAppWindow?.close();
resolve(signedMessage);
},
);
});
}

async addAssets(_assets: Asset[]): Promise<boolean> {
Expand Down
3 changes: 3 additions & 0 deletions packages/bako-safe/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ export const WINDOW: any = HAS_WINDOW ? window : {};

//storage
export const SESSION_ID = 'sessionId';
export const IS_SAFARI = /^((?!chrome|android).)*safari/i.test(
WINDOW.navigator?.userAgent,
);
3 changes: 3 additions & 0 deletions packages/bako-safe/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export enum BakoSafeConnectorEvents {

//auth
AUTH_CONFIRMED = '[AUTH_CONFIRMED]',

//sign
SIGN_CONFIRMED = '[SIGN_CONFIRMED]',
}

export enum BakoSafeUsernames {
Expand Down
2 changes: 1 addition & 1 deletion packages/bako-safe/tests/BakoSafeConnector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('signMessage()', () => {

expect(
connector.signMessage(Address.fromRandom().toString(), 'message'),
).rejects.toThrowError('Method not implemented.');
).rejects.toThrowError('User rejected the request');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ console.log(isSupportedNetwork);
```

#### Defined in
[packages/react/src/hooks/useIsSupportedNetwork.tsx:29](https://github.com/fuellabs/fuel-connectors/blob/main/packages/react/src/hooks/useIsSupportedNetwork.tsx#L29)
[packages/react/src/hooks/useIsSupportedNetwork.tsx:30](https://github.com/fuellabs/fuel-connectors/blob/main/packages/react/src/hooks/useIsSupportedNetwork.tsx#L30)

___
Loading