Skip to content

Commit d182321

Browse files
authored
Merge pull request #816 from TokenScript/staging
Staging
2 parents e2d91d4 + e1fd9f5 commit d182321

File tree

7 files changed

+23
-24
lines changed

7 files changed

+23
-24
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ Patch release to support the upgrade of attestations.
44

55
### Upgrade Steps
66

7-
- Update NPM package to version 3.0.1
7+
- Update NPM package to version 3.0.2
88

99
### Breaking Changes
1010

1111
[none]
1212

1313
### New Features
1414

15-
- Ability to delete existing attestations
15+
[none]
1616

1717
### Bug Fixes
1818

19-
- Added support for upgrading attestations for live projects (method added via TicketStorage deleteTicketByDecodedTokenOrId)
19+
- attestationWindowConfig check to the existence of window before usage (issue found applicable to full stack web applications)
20+
- updated list of attestation schema id's to be ignored for off chain attestation managment (ensuring readability of valid attestations)
2021

2122
### Performance Improvements
2223

2324
[none]
2425

2526
**Full Change log**:
2627

27-
https://github.com/TokenScript/token-negotiator/compare/v3.0.0...v3.0.1
28+
https://github.com/TokenScript/token-negotiator/compare/v3.0.1...v3.0.2

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tokenscript/token-negotiator",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Token-negotiator a token attestation bridge between web 2.0 and 3.0.",
55
"module": "dist/index.js",
66
"types": "dist/index.d.ts",

src/outlet/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export const defaultConfig = {
1313
whitelistDialogHeight: '350px',
1414
}
1515

16-
export const attestationWindowConfig = {
17-
max_width: window.innerWidth < 700 ? '400px' : '450px',
18-
min_height: window.innerHeight < 600 ? '600px' : '650px',
16+
const attestationWindowConfig = {
17+
max_width: typeof window !== 'undefined' && window.innerWidth < 700 ? '400px' : '450px',
18+
min_height: typeof window !== 'undefined' && window.innerHeight < 600 ? '600px' : '650px',
1919
}
2020

2121
export class Outlet extends LocalOutlet {

src/outlet/ticketStorage.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ export const DEFAULT_EAS_SCHEMA: TicketSchema = {
8787
],
8888
}
8989

90+
export const DEFAULT_SCHEMA_UIDS = [
91+
'0x0000000000000000000000000000000000000000000000000000000000000000',
92+
// string eventId,string ticketId,uint8 ticketClass,bytes commitment
93+
'0x7f6fb09beb1886d0b223e9f15242961198dd360021b2c9f75ac879c0f786cafd',
94+
// string devconId,string ticketIdString,uint8 ticketClass,bytes commitment
95+
'0x0630f3342772bf31b669bdbc05af0e9e986cf16458f292dfd3b57564b3dc3247',
96+
]
97+
9098
export class TicketStorage {
9199
private ticketCollections: TicketStorageSchema = {}
92100

@@ -332,13 +340,7 @@ export class TicketStorage {
332340

333341
let idFields: string[] | undefined
334342

335-
if (
336-
schemaUid !== '0x0000000000000000000000000000000000000000000000000000000000000000' &&
337-
// string eventId,string ticketId,uint8 ticketClass,bytes commitment
338-
schemaUid !== '0x7f6fb09beb1886d0b223e9f15242961198dd360021b2c9f75ac879c0f786cafd' &&
339-
// string devconId,string ticketIdString,uint8 ticketClass,bytes commitment
340-
schemaUid !== '0x0630f3342772bf31b669bdbc05af0e9e986cf16458f292dfd3b57564b3dc3247'
341-
) {
343+
if (DEFAULT_SCHEMA_UIDS.indexOf(schemaUid) === -1) {
342344
let issuerConfig
343345

344346
// Once we have decoded the URL, we have a schema ID

src/utils/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { KeyPair } from '@tokenscript/attestation/dist/libs/KeyPair'
33
import { sha256 } from 'ethers/lib/utils'
44
import { OffChainTokenConfig } from '../client/interface'
55
import { OutletIssuerInterface } from '../outlet/interfaces'
6+
import { DEFAULT_SCHEMA_UIDS } from '../outlet/ticketStorage'
67

78
export interface IssuerHashMap {
89
[collectionId: string]: string[]
@@ -242,12 +243,7 @@ export const createIssuerHashArray = (issuer: OffChainTokenConfig | OutletIssuer
242243
// output: 32 byte hash
243244
export const createOffChainCollectionHash = (key: KeyPair, eventId: string, schemaUid?: string) => {
244245
// Only include custom schemaUids in the hash
245-
const schemaPart =
246-
schemaUid &&
247-
schemaUid !== '0x0000000000000000000000000000000000000000000000000000000000000000' &&
248-
schemaUid !== '0x7f6fb09beb1886d0b223e9f15242961198dd360021b2c9f75ac879c0f786cafd'
249-
? '-' + schemaUid
250-
: ''
246+
const schemaPart = schemaUid && DEFAULT_SCHEMA_UIDS.indexOf(schemaUid) === -1 ? '-' + schemaUid : ''
251247

252248
const encoder = new TextEncoder()
253249
return sha256(encoder.encode(key.getPublicKeyAsHexStr() + '-' + eventId + schemaPart))

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// modified by build process.
2-
export const VERSION = '3.0.1'
2+
export const VERSION = '3.0.2'

0 commit comments

Comments
 (0)