Skip to content

Commit

Permalink
Merge pull request #798 from airgap-it/chore/beta_release
Browse files Browse the repository at this point in the history
chore: release
  • Loading branch information
jsamol authored Sep 4, 2024
2 parents 2541592 + 5559a82 commit 8674705
Show file tree
Hide file tree
Showing 24 changed files with 370 additions and 314 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "4.2.2",
"version": "4.3.0",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
273 changes: 135 additions & 138 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
"@airgap/beacon-ui": "file:packages/beacon-ui",
"@airgap/beacon-utils": "file:packages/beacon-utils",
"@airgap/beacon-wallet": "file:packages/beacon-wallet",
"@walletconnect/sign-client": "2.11.2",
"@walletconnect/types": "2.11.2",
"@walletconnect/utils": "2.11.2",
"@walletconnect/sign-client": "2.14.0",
"@walletconnect/types": "2.14.0",
"@walletconnect/utils": "2.14.0",
"@web3modal/standalone": "2.0.0",
"stream-browserify": "^3.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/beacon-blockchain-substrate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-blockchain-substrate",
"version": "4.2.2",
"version": "4.3.0",
"description": "This package adds support for `substrate` based blockchains. It can be used in combination with the `@airgap/beacon-dapp` or `@airgap/beacon-wallet` packages.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -34,7 +34,7 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-types": "4.2.2",
"@airgap/beacon-ui": "4.2.2"
"@airgap/beacon-types": "4.3.0",
"@airgap/beacon-ui": "4.3.0"
}
}
6 changes: 3 additions & 3 deletions packages/beacon-blockchain-tezos-sapling/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-blockchain-tezos-sapling",
"version": "4.2.2",
"version": "4.3.0",
"description": "This package adds support for `tezos-sapling`, the sapling integration on the Tezos blockchain. It can be used in combination with the `@airgap/beacon-dapp` or `@airgap/beacon-wallet` packages.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -34,7 +34,7 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-types": "4.2.2",
"@airgap/beacon-ui": "4.2.2"
"@airgap/beacon-types": "4.3.0",
"@airgap/beacon-ui": "4.3.0"
}
}
6 changes: 3 additions & 3 deletions packages/beacon-blockchain-tezos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-blockchain-tezos",
"version": "4.2.2",
"version": "4.3.0",
"description": "This package adds support for the `tezos` blockchain. It can be used in combination with the `@airgap/beacon-dapp` or `@airgap/beacon-wallet` packages.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -34,7 +34,7 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-types": "4.2.2",
"@airgap/beacon-ui": "4.2.2"
"@airgap/beacon-types": "4.3.0",
"@airgap/beacon-ui": "4.3.0"
}
}
6 changes: 3 additions & 3 deletions packages/beacon-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-core",
"version": "4.2.2",
"version": "4.3.0",
"description": "This package contains internal methods that are used by both the dApp and wallet client.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -34,8 +34,8 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-types": "4.2.2",
"@airgap/beacon-utils": "4.2.2",
"@airgap/beacon-types": "4.3.0",
"@airgap/beacon-utils": "4.3.0",
"@stablelib/ed25519": "^1.0.3",
"@stablelib/nacl": "^1.0.4",
"@stablelib/utf8": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-core/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const SDK_VERSION: string = '4.2.2'
export const SDK_VERSION: string = '4.3.0'
export const BEACON_VERSION: string = '3'

export const NOTIFICATION_ORACLE_URL: string =
Expand Down
12 changes: 6 additions & 6 deletions packages/beacon-dapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-dapp",
"version": "4.2.2",
"version": "4.3.0",
"description": "Use this package on your dApp to instanciate a DAppClient object and communicate to wallets.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -35,11 +35,11 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-core": "4.2.2",
"@airgap/beacon-transport-matrix": "4.2.2",
"@airgap/beacon-transport-postmessage": "4.2.2",
"@airgap/beacon-transport-walletconnect": "4.2.2",
"@airgap/beacon-ui": "4.2.2",
"@airgap/beacon-core": "4.3.0",
"@airgap/beacon-transport-matrix": "4.3.0",
"@airgap/beacon-transport-postmessage": "4.3.0",
"@airgap/beacon-transport-walletconnect": "4.3.0",
"@airgap/beacon-ui": "4.3.0",
"broadcast-channel": "^7.0.0"
}
}
37 changes: 27 additions & 10 deletions packages/beacon-dapp/src/dapp-client/DAppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,14 @@ export class DAppClient extends Client {
}
}

private prepareRequest(message: any, isV3 = false) {
private async prepareRequest(message: any, isV3 = false) {
if (!this.multiTabChannel.isLeader()) {
return
}

// block until the transport is ready
await this._transport.promise

this.openRequestsOtherTabs.add(message.id)
isV3
? this.makeRequestV3(message.data, message.id)
Expand Down Expand Up @@ -1071,6 +1074,14 @@ export class DAppClient extends Client {
})
}

private async checkMakeRequest() {
const isResolved = this._transport.isResolved()
const isWCInstance = isResolved && (await this.transport) instanceof WalletConnectTransport
const isLeader = this.multiTabChannel.isLeader()

return !isResolved || (isResolved && (!isWCInstance || (isWCInstance && isLeader)))
}

/**
* Will remove the account from the local storage and set a new active account if necessary.
*
Expand Down Expand Up @@ -1359,7 +1370,7 @@ export class DAppClient extends Client {

const logId = `makeRequestV3 ${Date.now()}`
logger.time(true, logId)
const res = this.multiTabChannel.isLeader()
const res = (await this.checkMakeRequest())
? this.makeRequestV3<
BlockchainRequestV3<string>,
BeaconMessageWrapper<BlockchainResponseV3<string>>
Expand Down Expand Up @@ -1428,9 +1439,7 @@ export class DAppClient extends Client {
logger.time(true, logId)

const res =
this.multiTabChannel.isLeader() ||
!this._activeAccount.isResolved() ||
!(await this.getActiveAccount())
(await this.checkMakeRequest()) || !(await this.getActiveAccount())
? this.makeRequest<PermissionRequest, PermissionResponse>(request)
: this.makeRequestBC<PermissionRequest, PermissionResponse>(request)

Expand Down Expand Up @@ -1508,7 +1517,7 @@ export class DAppClient extends Client {
this.sendMetrics('performance-metrics/save', await this.buildPayload('message', 'start'))
const logId = `makeRequest ${Date.now()}`
logger.time(true, logId)
const res = this.multiTabChannel.isLeader()
const res = (await this.checkMakeRequest())
? this.makeRequest<ProofOfEventChallengeRequest, ProofOfEventChallengeResponse>(request)
: this.makeRequestBC<ProofOfEventChallengeRequest, ProofOfEventChallengeResponse>(request)

Expand Down Expand Up @@ -1575,7 +1584,7 @@ export class DAppClient extends Client {
const logId = `makeRequest ${Date.now()}`
logger.time(true, logId)

const res = this.multiTabChannel.isLeader()
const res = (await this.checkMakeRequest())
? this.makeRequest<
SimulatedProofOfEventChallengeRequest,
SimulatedProofOfEventChallengeResponse
Expand Down Expand Up @@ -1675,7 +1684,7 @@ export class DAppClient extends Client {
this.sendMetrics('performance-metrics/save', await this.buildPayload('message', 'start'))
const logId = `makeRequest ${Date.now()}`
logger.time(true, logId)
const res = this.multiTabChannel.isLeader()
const res = (await this.checkMakeRequest())
? this.makeRequest<SignPayloadRequest, SignPayloadResponse>(request)
: this.makeRequestBC<SignPayloadRequest, SignPayloadResponse>(request)

Expand Down Expand Up @@ -1791,7 +1800,7 @@ export class DAppClient extends Client {
const logId = `makeRequest ${Date.now()}`
logger.time(true, logId)

const res = this.multiTabChannel.isLeader()
const res = (await this.checkMakeRequest())
? this.makeRequest<OperationRequest, OperationResponse>(request)
: this.makeRequestBC<OperationRequest, OperationResponse>(request)

Expand Down Expand Up @@ -1851,7 +1860,7 @@ export class DAppClient extends Client {
this.sendMetrics('performance-metrics/save', await this.buildPayload('message', 'start'))
const logId = `makeRequest ${Date.now()}`
logger.time(true, logId)
const res = this.multiTabChannel.isLeader()
const res = (await this.checkMakeRequest())
? this.makeRequest<BroadcastRequest, BroadcastResponse>(request)
: this.makeRequestBC<BroadcastRequest, BroadcastResponse>(request)

Expand Down Expand Up @@ -2509,6 +2518,14 @@ export class DAppClient extends Client {
return
}

if (await this.addRequestAndCheckIfRateLimited()) {
this.events
.emit(BeaconEvent.LOCAL_RATE_LIMIT_REACHED)
.catch((emitError) => console.warn(emitError))

throw new Error('rate limit reached')
}

const id = await generateGUID()

this.multiTabChannel.postMessage({
Expand Down
22 changes: 11 additions & 11 deletions packages/beacon-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-sdk",
"version": "4.2.2",
"version": "4.3.0",
"description": "The `beacon-sdk` simplifies and abstracts the communication between dApps and wallets over different transport layers.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -35,15 +35,15 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-blockchain-substrate": "4.2.2",
"@airgap/beacon-blockchain-tezos": "4.2.2",
"@airgap/beacon-core": "4.2.2",
"@airgap/beacon-dapp": "4.2.2",
"@airgap/beacon-transport-matrix": "4.2.2",
"@airgap/beacon-transport-postmessage": "4.2.2",
"@airgap/beacon-types": "4.2.2",
"@airgap/beacon-ui": "4.2.2",
"@airgap/beacon-utils": "4.2.2",
"@airgap/beacon-wallet": "4.2.2"
"@airgap/beacon-blockchain-substrate": "4.3.0",
"@airgap/beacon-blockchain-tezos": "4.3.0",
"@airgap/beacon-core": "4.3.0",
"@airgap/beacon-dapp": "4.3.0",
"@airgap/beacon-transport-matrix": "4.3.0",
"@airgap/beacon-transport-postmessage": "4.3.0",
"@airgap/beacon-types": "4.3.0",
"@airgap/beacon-ui": "4.3.0",
"@airgap/beacon-utils": "4.3.0",
"@airgap/beacon-wallet": "4.3.0"
}
}
6 changes: 3 additions & 3 deletions packages/beacon-transport-matrix/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-transport-matrix",
"version": "4.2.2",
"version": "4.3.0",
"description": "This package contains methods to facilitate communication over the Beacon network, a decentralised P2P network that is based on the matrix protocol.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -34,8 +34,8 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-core": "4.2.2",
"@airgap/beacon-utils": "4.2.2",
"@airgap/beacon-core": "4.3.0",
"@airgap/beacon-utils": "4.3.0",
"axios": "^1.6.2"
}
}
8 changes: 4 additions & 4 deletions packages/beacon-transport-postmessage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-transport-postmessage",
"version": "4.2.2",
"version": "4.3.0",
"description": "This package contains methods to facilitate communication over the postmessage interface of the browser to talk to browser extensions.",
"author": "Andreas Gassmann <[email protected]>",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -34,8 +34,8 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-core": "4.2.2",
"@airgap/beacon-types": "4.2.2",
"@airgap/beacon-utils": "4.2.2"
"@airgap/beacon-core": "4.3.0",
"@airgap/beacon-types": "4.3.0",
"@airgap/beacon-utils": "4.3.0"
}
}
10 changes: 5 additions & 5 deletions packages/beacon-transport-walletconnect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgap/beacon-transport-walletconnect",
"version": "4.2.2",
"version": "4.3.0",
"description": "This package contains methods to facilitate communication over the WalletConnect network.",
"author": "Papers AG",
"homepage": "https://walletbeacon.io",
Expand Down Expand Up @@ -34,9 +34,9 @@
"url": "https://github.com/airgap-it/beacon-sdk/issues"
},
"dependencies": {
"@airgap/beacon-core": "4.2.2",
"@airgap/beacon-types": "4.2.2",
"@airgap/beacon-utils": "4.2.2",
"@walletconnect/sign-client": "2.11.2"
"@airgap/beacon-core": "4.3.0",
"@airgap/beacon-types": "4.3.0",
"@airgap/beacon-utils": "4.3.0",
"@walletconnect/sign-client": "2.14.0"
}
}
Loading

0 comments on commit 8674705

Please sign in to comment.