Skip to content

Commit

Permalink
Merge pull request #645 from TokenScript/staging
Browse files Browse the repository at this point in the history
- Release v2.5.0
  • Loading branch information
snowwhitedev committed Apr 14, 2023
2 parents 3b1df7a + a75792b commit b5dceae
Show file tree
Hide file tree
Showing 35 changed files with 1,768 additions and 939 deletions.
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/ban-ts-comment": "off",
Expand Down Expand Up @@ -54,7 +55,6 @@
"undefined"
],
"id-match": "error",
"indent": ["error", "tab", { "SwitchCase": 1 }],
"no-eval": "error",
"no-redeclare": "error",
"no-trailing-spaces": "off",
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/tn-p1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ jobs:
npm i -E "@tokenscript/attestation@${ATTESTATION_VER}"
cat package.json
fi
# make SNAPSHOT-staging package to use @tokenscript/attestation:SNAPSHOT-staging
if [ "${GITHUB_EVENT_NAME}" = "push" -a "${GITHUB_REF_NAME}" = "staging" ]; then
echo "//npm.pkg.github.com/:_authToken=${GPR_KEY}" >> .npmrc
echo "@tokenscript:registry=https://npm.pkg.github.com" >> .npmrc
cat .npmrc
npm i "@tokenscript/attestation@SNAPSHOT-staging"
fi
rm -f .npmrc
env:
ATTESTATION_VER: ${{ inputs.attestation_ver }}
USE_GITHUB_PACKAGES: ${{ inputs.use_github_packages }}
GPR_USER: ${{ secrets.GPR_USER }}
GPR_KEY: ${{ secrets.GPR_KEY }}
GPR_KEY: ${{ secrets.GITHUB_TOKEN }}

- name: build
run: |
Expand Down Expand Up @@ -79,8 +86,8 @@ jobs:
if: github.event_name == 'push' && contains('refs/heads/staging refs/heads/main', github.ref)
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
node-version: "16.x"
registry-url: "https://npm.pkg.github.com"

- name: "Publish NPM snapshot"
if: github.event_name == 'push' && contains('refs/heads/staging refs/heads/main', github.ref)
Expand All @@ -98,4 +105,4 @@ jobs:
package-name: token-negotiator
package-type: npm
min-versions-to-keep: 4
delete-only-pre-release-versions: "true"
delete-only-pre-release-versions: "true"
14 changes: 11 additions & 3 deletions .github/workflows/tn-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
- name: install dependencies
run: |
npm ci
# make SNAPSHOT-staging package to use @tokenscript/attestation:SNAPSHOT-staging
if [ "${GITHUB_REF_NAME}" = "staging" ]; then
echo "//npm.pkg.github.com/:_authToken=${GPR_KEY}" >> .npmrc
echo "@tokenscript:registry=https://npm.pkg.github.com" >> .npmrc
npm i "@tokenscript/attestation@SNAPSHOT-staging"
fi
env:
GPR_KEY: ${{ secrets.GITHUB_TOKEN }}

- name: build
run: |
Expand All @@ -31,8 +39,8 @@ jobs:
- name: "Setup registry"
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
node-version: "16.x"
registry-url: "https://npm.pkg.github.com"

- name: "Publish NPM snapshot"
env:
Expand All @@ -49,4 +57,4 @@ jobs:
package-name: token-negotiator
package-type: npm
min-versions-to-keep: 4
delete-only-pre-release-versions: "true"
delete-only-pre-release-versions: "true"
1 change: 1 addition & 0 deletions .github/workflows/tn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
jobs:
tn-p1:
uses: ./.github/workflows/tn-p1.yml
secrets: inherit

sonarcloud:
needs:
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
"useTabs": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 120,
"printWidth": 140,
"semi": false
}
},
Expand Down
20 changes: 12 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
> Description
The patch release addresses compatibility issues with the es6 version of the build.
Feature release with fixes, added support through Wallet Connect V2, and use of signatures via Solana and Flow.

### Upgrade Steps

* Update NPM package to version 2.4.3
* Update NPM package to version 2.5.0

### Breaking Changes

[none]

### New Features

[none]
* Tokens loaded event hook added
* Wallet Connect V2 IM token wallet support
* Added sign/verify for flow and solana

### Bug Fixes

* Imported Wallect Connect V2 reference
* TS config update for ES6 compatibility issue found
* Corrections to README
* base64 to Uint8array
* Sonar Cloud code quality updates
* Namespace prefix for off chain communication
* ES LINT update
* Ability to extend library classes
* Support for es5 browsers
* Disabled support of iOS Edge with Torus

### Performance Improvements

Expand All @@ -31,4 +35,4 @@ The patch release addresses compatibility issues with the es6 version of the bui

**Full Change log**:

https://github.com/TokenScript/token-negotiator/compare/v2.4.0...v2.4.3
https://github.com/TokenScript/token-negotiator/compare/v2.4.3...v2.5.0
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ negotiator.on("tokens-selected", (tokens) => {
// use tokens
});

negotiator.on("tokens-loaded", (data) => {
// use the collections information which were loaded
})

negotiator.on("token-proof", (proof) => {
// use proof
});
Expand Down Expand Up @@ -285,6 +289,10 @@ negotiator.on("tokens", (issuerTokens) => {
// use tokens
});

negotiator.on("tokens-loaded", (data) => {
// use the collections information which were loaded
})

negotiator.on("token-proof", (tokenProof) => {
// use proof
});
Expand Down Expand Up @@ -316,7 +324,7 @@ const onChainIssuer = {
```

### Managing Issuers on chain (Solana)

:warning: You must supply a certified collectionAddress OR a combination of symbol and either ownerProgram or updateAuthority.
```javascript
/**
* @param {String} blockchain string of which blockchain is needed (optional input: default is 'evm')
Expand Down Expand Up @@ -422,6 +430,10 @@ negotiator.on("tokens-selected", callback);
<td>'tokens'</td>
<td>Tokens when using passive mode (auto selected)</td>
</tr>
<tr>
<td>'tokens-loaded'</td>
<td>Collections information(the count) which were loaded</td>
</tr>
<tr>
<td>'network-change'</td>
<td>Chain</td>
Expand Down
63 changes: 63 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</head>
<body onload="init()">
<button onclick="switchTheme()">Switch theme</button>
<button onclick="reloadIssuers()">Reload</button>
<div class="overlay-tn"></div>
<script>
var theme = "dark";
Expand Down Expand Up @@ -239,8 +240,70 @@
console.log(proof);
});

window.negotiator.on('tokens-loaded', (data) => {
console.log(`${data.loadedCollections} tokens were loaded`)
})

window.negotiator.negotiate();
}

function reloadIssuers() {
window.negotiator.negotiate([
{
collectionID: "penthouse-panther-club",
collectionAddress: "ff846ef2eed57e5367cf8826e63f4d53fe28d28aa67417accb6e4b48cbd19136",
updateAuthority: "92oYPmrr1BHznizuZmpKZ3MFRadMFYRTCxo9Pf34mZKX",
tokenProgram: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
onChain: true,
symbol: "PPC",
chain: "mainnet",
blockchain: "solana",
},
{
hideToggle : false,
collectionID: "pixel",
collectionAddress: "166424b16c4c7f40eb852f9eb2d0d6869a9ed7ac54a8e6afbd516676bfbbeb19",
onChain: true,
symbol: "PIXEL",
chain: "mainnet",
blockchain: "solana",
},
{
onChain: true,
collectionID: "expansion-punks",
contract: '0x0d0167a823c6619d430b1a96ad85b888bcf97c37',
chain: 'eth',
blockchain: "evm",
},
{
onChain: true,
collectionID: "fantom-collection-test",
contract: '0x94e22c14118353651636f9af43cd0a5a08b93da3',
chain: 'fantom',
blockchain: "evm",
},
{
hideToggle : true,
noTokenMsg: "<p>If you have a token please:</p><p>1. Open your magic link inside this browser.<br/>2. Refresh this page.</p>",
onChain: true,
collectionID: "bsc-collection-test",
contract: '0xF5db804101d8600c26598A1Ba465166c33CdAA4b',
chain: 'bsc',
blockchain: "evm",
},
{
onChain: true,
collectionID: "tt",
contract: '0x76be3b62873462d2142405439777e971754e8e77',
chain: 'eth',
blockchain: "evm",
},
{ onChain: true, collectionID: "Perion", contract: '0x96af92ae2d822a0f191455ceca4d4e7ee227668e', chain: 'mumbai', blockchain: "evm" },
{ collectionID: 'COOLCATS-#2426-14', onChain: true, contract: '0x3C7e352481F4b2fdEc1e642a3f0018661c77513D', chain: 'eth', openSeaSlug: 'devcon-vi-suit-up-collection' },
{ collectionID: 'Town-Hall', onChain: true, contract: '0x81b30ff521D1fEB67EDE32db726D95714eb00637', chain: 'Optimism' },
])

}
function switchTheme() {
theme = theme === "dark" ? "light" : "dark";
window.negotiator.switchTheme(theme);
Expand Down
Loading

0 comments on commit b5dceae

Please sign in to comment.