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

Feature/active interface change #768

Merged
merged 8 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tokenscript/token-negotiator",
"version": "2.8.0-nick-test",
"version": "3.0.0",
"description": "Token-negotiator a token attestation bridge between web 2.0 and 3.0.",
"module": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/client/__tests__/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ describe('client spec', () => {
test('tokenNegotiatorClient method eventSender event hook functions', async () => {
const tokenNegotiatorClient = getOffChainConfigClient()
tokenNegotiatorClient.eventSender('emitAllTokensToClient', [])
tokenNegotiatorClient.eventSender('emitSelectedTokensToClient', { selectedTokens: null })
tokenNegotiatorClient.eventSender('emitSelectedTokensToClient', null)
tokenNegotiatorClient.eventSender('emitProofToClient', { data: 'test', issuer: 'devcon', error: null })
tokenNegotiatorClient.eventSender('emitNetworkChange', '0x1')
})
Expand Down
13 changes: 4 additions & 9 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,7 @@ export class Client {
}

if (this.config.autoEnableTokens && Object.keys(this.tokenStore.getSelectedTokens()).length)
this.eventSender('tokens-selected', {
selectedTokens: this.tokenStore.getSelectedTokens(),
})
this.eventSender('tokens-selected', this.tokenStore.getSelectedTokens())
nicktaras marked this conversation as resolved.
Show resolved Hide resolved

if (openPopup || (this.config.uiOptions.autoPopup === true && autoOpenPopup)) this.ui.openOverlay()
}
Expand Down Expand Up @@ -660,7 +658,7 @@ export class Client {
tokens[issuer] = { tokens: tokens[issuer] }
}

this.eventSender('tokens', tokens)
this.eventSender('tokens-selected', tokens)
this.eventSender('tokens-loaded', { loadedCollections: Object.keys(tokens).length })

// Feature not supported when an end users third party cookies are disabled
Expand All @@ -685,9 +683,7 @@ export class Client {
}

if (this.config.autoEnableTokens) {
this.eventSender('tokens-selected', {
selectedTokens: this.tokenStore.getSelectedTokens(),
})
this.eventSender('tokens-selected', this.tokenStore.getSelectedTokens())
}

return tokens
Expand Down Expand Up @@ -780,7 +776,7 @@ export class Client {

updateSelectedTokens(selectedTokens) {
this.tokenStore.setSelectedTokens(selectedTokens)
this.eventSender('tokens-selected', { selectedTokens })
this.eventSender('tokens-selected', selectedTokens)
}

async prepareToAuthenticateToken(authRequest: AuthenticateInterface) {
Expand Down Expand Up @@ -1098,7 +1094,6 @@ export class Client {
this.eventSender('tokens-selected', {
selectedTokens: this.tokenStore.getSelectedTokens(),
})
this.eventSender('tokens', this.tokenStore.getSelectedTokens())
return res.data.tokens
}
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// modified by build process.
export const VERSION = '2.8.0-nick-test'
export const VERSION = '3.0.0'