Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
9a7b2098ee Version Packages (#1426)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-02 08:45:39 -07:00
Mariano FuentesandGitHub 2b96f71e19 see if this fixes bug with creating directory (#1419) 2023-08-02 05:24:22 +00:00
3b6b0746b3 [service-utils] - allow account level auth via jwt (#1411)
Co-authored-by: Tair Asim <[email protected]>
2023-08-02 05:23:15 +00:00
iketwandGitHub b0ec1d8083 [Wallets] Add plugin to transform flow types to fix RN FlatList bug (#1425) 2023-08-01 23:09:45 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
0af916e42e Version Packages (#1418)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-31 19:21:41 -07:00
iketwandGitHub fbde927a0c [Wallets] Add transform private methods plugin for RN (#1421) 2023-08-01 02:04:50 +00:00
Joaquim VergesandGitHub 952009cd73 [service-utils] authorize calls if domains are set to * (#1420) 2023-07-31 18:14:20 -07:00
Joaquim VergesandGitHub 580e77b170 [AuthService] return accountId from authorize call (#1417) 2023-07-31 20:48:02 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
d275493c59 Version Packages (#1416)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-29 00:35:56 -07:00
Joaquim VergesandGitHub 256ee0d5ec [All] downgrade preconstruct to 2.7.0 (#1415) 2023-07-29 00:24:54 -07:00
68 changed files with 3655 additions and 440 deletions
+23
View File
@@ -1,5 +1,28 @@
# @thirdweb-dev/auth
## 3.2.24
### Patch Changes
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e), [`b0ec1d80`](https://github.com/thirdweb-dev/js/commit/b0ec1d80839efccad11b50afbf2216c2c132cf7e)]:
- @thirdweb-dev/wallets@1.1.7
## 3.2.23
### Patch Changes
- Updated dependencies [[`fbde927a`](https://github.com/thirdweb-dev/js/commit/fbde927a0cb36a6269e045d8e577536f23164ef7)]:
- @thirdweb-dev/wallets@1.1.6
## 3.2.22
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/wallets@1.1.5
## 3.2.21
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.2.21",
"version": "3.2.24",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
@@ -86,7 +86,7 @@
"@microsoft/api-documenter": "^7.22.30",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@solana/web3.js": "^1.62.0",
"@swc-node/register": "^1.6.6",
"@swc/core": "^1.3.71",
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/chains
## 0.1.40
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
## 0.1.39
### Patch Changes
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"name": "Mintara Mainnet",
"title": "Mintara Mainnet",
"chain": "Mintara",
"icon": {
"url": "ipfs://bafybeie7jzlzlpz7c3a3oh4x5joej23dj2qf3cexmchjyc72hv3fblcaja",
"width": 256,
"height": 256,
"format": "png"
},
"rpc": [
"https://mintara.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/mintara/mainnet/rpc"
],
"faucets": [],
"nativeCurrency": {
"name": "MINTARA",
"symbol": "MNTR",
"decimals": 18
},
"infoURL": "https://playthink.co.jp",
"shortName": "mintara",
"chainId": 1080,
"networkId": 1080,
"explorers": [
{
"name": "explorer",
"url": "https://subnets.avax.network/mintara",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "mintara"
} as const satisfies Chain;
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"name": "Kalar Chain Mainnet",
"chain": "KLC",
"icon": {
"url": "ipfs://bafkreihfoy2kgf2rebaoicso7z5h7ju46z6gtr64mskkths3qbfkrtnkjm",
"width": 190,
"height": 170,
"format": "png"
},
"rpc": [
"https://kalar-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"http://rpc-api.kalarchain.tech"
],
"faucets": [],
"nativeCurrency": {
"name": "Kalar",
"symbol": "KLC",
"decimals": 18
},
"infoURL": "https://kalarchain.tech",
"shortName": "KLC",
"chainId": 1379,
"networkId": 1379,
"explorers": [
{
"name": "kalarscan",
"url": "https://explorer.kalarchain.tech",
"icon": {
"url": "ipfs://bafkreidbzzv3lrwlzquhlpl4jcmr54sifhi5ufoek6olb5kjh3h3kvktdq",
"width": 411,
"height": 159,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "kalar-chain"
} as const satisfies Chain;
+10 -4
View File
@@ -5,17 +5,23 @@ export default {
"rpc": [
"https://harmony-shard-0.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.harmony.one",
"https://api.s0.t.hmny.io"
],
"faucets": [
"https://free-online-app.com/faucet-for-eth-evm-chains/"
"https://a.api.s0.t.hmny.io",
"https://api.s0.t.hmny.io",
"https://rpc.ankr.com/harmony",
"https://harmony.api.onfinality.io/public",
"https://1rpc.io/one"
],
"faucets": [],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"slip44": 1023,
"ens": {
"registry": "0x4cd2563118e57b19179d8dc033f2b0c5b5d69ff5"
},
"shortName": "hmy-s0",
"chainId": 1666600000,
"networkId": 1666600000,
+8
View File
@@ -13,9 +13,17 @@ export default {
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"slip44": 1023,
"shortName": "hmy-s1",
"chainId": 1666600001,
"networkId": 1666600001,
"explorers": [
{
"name": "Harmony Block Explorer",
"url": "https://explorer.harmony.one/blocks/shard/1",
"standard": "none"
}
],
"testnet": false,
"slug": "harmony-shard-1"
} as const satisfies Chain;
+8
View File
@@ -13,9 +13,17 @@ export default {
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"slip44": 1023,
"shortName": "hmy-s2",
"chainId": 1666600002,
"networkId": 1666600002,
"explorers": [
{
"name": "Harmony Block Explorer",
"url": "https://explorer.harmony.one/blocks/shard/2",
"standard": "none"
}
],
"testnet": false,
"slug": "harmony-shard-2"
} as const satisfies Chain;
+8
View File
@@ -13,9 +13,17 @@ export default {
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"slip44": 1023,
"shortName": "hmy-s3",
"chainId": 1666600003,
"networkId": 1666600003,
"explorers": [
{
"name": "Harmony Block Explorer",
"url": "https://explorer.harmony.one/blocks/shard/3",
"standard": "none"
}
],
"testnet": false,
"slug": "harmony-shard-3"
} as const satisfies Chain;
+1 -1
View File
@@ -21,7 +21,7 @@ export default {
"explorers": [
{
"name": "Harmony Testnet Block Explorer",
"url": "https://explorer.pops.one",
"url": "https://explorer.testnet.harmony.one",
"standard": "EIP3091"
}
],
+10 -1
View File
@@ -6,7 +6,9 @@ export default {
"https://harmony-testnet-shard-1.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.s1.b.hmny.io"
],
"faucets": [],
"faucets": [
"https://faucet.pops.one"
],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
@@ -16,6 +18,13 @@ export default {
"shortName": "hmy-b-s1",
"chainId": 1666700001,
"networkId": 1666700001,
"explorers": [
{
"name": "Harmony Block Explorer",
"url": "https://explorer.testnet.harmony.one",
"standard": "none"
}
],
"testnet": true,
"slug": "harmony-testnet-shard-1"
} as const satisfies Chain;
-21
View File
@@ -1,21 +0,0 @@
import type { Chain } from "../src/types";
export default {
"name": "Harmony Testnet Shard 2",
"chain": "Harmony",
"rpc": [
"https://harmony-testnet-shard-2.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.s2.b.hmny.io"
],
"faucets": [],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"shortName": "hmy-b-s2",
"chainId": 1666700002,
"networkId": 1666700002,
"testnet": true,
"slug": "harmony-testnet-shard-2"
} as const satisfies Chain;
-21
View File
@@ -1,21 +0,0 @@
import type { Chain } from "../src/types";
export default {
"name": "Harmony Testnet Shard 3",
"chain": "Harmony",
"rpc": [
"https://harmony-testnet-shard-3.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.s3.b.hmny.io"
],
"faucets": [],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"shortName": "hmy-b-s3",
"chainId": 1666700003,
"networkId": 1666700003,
"testnet": true,
"slug": "harmony-testnet-shard-3"
} as const satisfies Chain;
+3 -11
View File
@@ -4,11 +4,9 @@ export default {
"chain": "Harmony",
"rpc": [
"https://harmony-devnet-shard-0.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.s1.ps.hmny.io"
],
"faucets": [
"http://dev.faucet.easynode.one/"
"https://api.s0.ps.hmny.io"
],
"faucets": [],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
@@ -18,13 +16,7 @@ export default {
"shortName": "hmy-ps-s0",
"chainId": 1666900000,
"networkId": 1666900000,
"explorers": [
{
"name": "Harmony Block Explorer",
"url": "https://explorer.ps.hmny.io",
"standard": "EIP3091"
}
],
"explorers": [],
"testnet": false,
"slug": "harmony-devnet-shard-0"
} as const satisfies Chain;
+22
View File
@@ -0,0 +1,22 @@
import type { Chain } from "../src/types";
export default {
"name": "Harmony Devnet Shard 1",
"chain": "Harmony",
"rpc": [
"https://harmony-devnet-shard-1.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.s1.ps.hmny.io"
],
"faucets": [],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"shortName": "hmy-ps-s1",
"chainId": 1666900001,
"networkId": 1666900001,
"explorers": [],
"testnet": false,
"slug": "harmony-devnet-shard-1"
} as const satisfies Chain;
+3 -3
View File
@@ -1,9 +1,9 @@
import type { Chain } from "../src/types";
export default {
"name": "Cronos Mainnet Beta",
"name": "Cronos Mainnet",
"chain": "CRO",
"rpc": [
"https://cronos-beta.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://cronos.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://evm.cronos.org",
"https://cronos-evm.publicnode.com"
],
@@ -30,5 +30,5 @@ export default {
}
],
"testnet": false,
"slug": "cronos-beta"
"slug": "cronos"
} as const satisfies Chain;
+23 -3
View File
@@ -1,8 +1,20 @@
import type { Chain } from "../src/types";
export default {
"name": "Acala Mandala Testnet",
"name": "Acala Mandala Testnet TC9",
"chain": "mACA",
"rpc": [],
"rpc": [
"https://acala-mandala-testnet-tc9.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://eth-rpc-tc9.aca-staging.network",
"wss://eth-rpc-tc9.aca-staging.network"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [],
"nativeCurrency": {
"name": "Acala Mandala Token",
@@ -13,6 +25,14 @@ export default {
"shortName": "maca",
"chainId": 595,
"networkId": 595,
"slip44": 595,
"explorers": [
{
"name": "blockscout",
"url": "https://blockscout.mandala.aca-staging.network",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "acala-mandala-testnet"
"slug": "acala-mandala-testnet-tc9"
} as const satisfies Chain;
+12 -1
View File
@@ -2,7 +2,11 @@ import type { Chain } from "../src/types";
export default {
"name": "Karura Network Testnet",
"chain": "KAR",
"rpc": [],
"rpc": [
"https://karura-network-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://eth-rpc-karura-testnet.aca-staging.network",
"wss://eth-rpc-karura-testnet.aca-staging.network"
],
"faucets": [],
"nativeCurrency": {
"name": "Karura Token",
@@ -14,6 +18,13 @@ export default {
"chainId": 596,
"networkId": 596,
"slip44": 596,
"explorers": [
{
"name": "blockscout",
"url": "https://blockscout.karura-testnet.aca-staging.network",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "karura-network-testnet"
} as const satisfies Chain;
+12 -1
View File
@@ -2,7 +2,11 @@ import type { Chain } from "../src/types";
export default {
"name": "Acala Network Testnet",
"chain": "ACA",
"rpc": [],
"rpc": [
"https://acala-network-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://eth-rpc-acala-testnet.aca-staging.network",
"wss://eth-rpc-acala-testnet.aca-staging.network"
],
"faucets": [],
"nativeCurrency": {
"name": "Acala Token",
@@ -14,6 +18,13 @@ export default {
"chainId": 597,
"networkId": 597,
"slip44": 597,
"explorers": [
{
"name": "blockscout",
"url": "https://blockscout.acala-dev.aca-dev.network",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "acala-network-testnet"
} as const satisfies Chain;
+42
View File
@@ -0,0 +1,42 @@
import type { Chain } from "../src/types";
export default {
"name": "PEER Testnet",
"chain": "PEER",
"rpc": [
"https://peer-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"http://testnet-polka-host-232813573.us-west-1.elb.amazonaws.com"
],
"faucets": [
"https://testnet.peer.inc"
],
"nativeCurrency": {
"name": "PEER Token",
"symbol": "PEER",
"decimals": 18
},
"infoURL": "https://peer.inc",
"shortName": "PEER",
"chainId": 601,
"networkId": 601,
"icon": {
"url": "ipfs://QmPKKCdjEhP6CHekLD8YnhR2VsdjzprHapapDj7Wzqm52b",
"width": 1363,
"height": 760,
"format": "png"
},
"explorers": [
{
"name": "PEER Explorer",
"url": "https://testnet.peer.inc",
"standard": "none",
"icon": {
"url": "ipfs://QmPKKCdjEhP6CHekLD8YnhR2VsdjzprHapapDj7Wzqm52b",
"width": 1363,
"height": 760,
"format": "png"
}
}
],
"testnet": true,
"slug": "peer-testnet"
} as const satisfies Chain;
+21 -2
View File
@@ -2,18 +2,37 @@ import type { Chain } from "../src/types";
export default {
"name": "Karura Network",
"chain": "KAR",
"rpc": [],
"rpc": [
"https://karura-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://eth-rpc-karura.aca-api.network",
"wss://eth-rpc-karura.aca-api.network"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [],
"nativeCurrency": {
"name": "Karura Token",
"symbol": "KAR",
"decimals": 18
},
"infoURL": "https://karura.network",
"infoURL": "https://acala.network/karura",
"shortName": "kar",
"chainId": 686,
"networkId": 686,
"slip44": 686,
"explorers": [
{
"name": "blockscout",
"url": "https://blockscout.karura.network",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "karura-network"
} as const satisfies Chain;
+5 -5
View File
@@ -1,6 +1,6 @@
import type { Chain } from "../src/types";
export default {
"name": "ZetaChain Athens Testnet",
"name": "ZetaChain Athens 3 Testnet",
"chain": "ZetaChain",
"icon": {
"url": "ipfs://QmP4Gnf4Lkp8q5LQVePNjAWxSqrw8vU2JAf7amcFz4vEUy",
@@ -9,8 +9,8 @@ export default {
"format": "png"
},
"rpc": [
"https://zetachain-athens-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.athens2.zetachain.com/evm"
"https://zetachain-athens-3-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.ankr.com/zetachain_evm_athens_testnet"
],
"faucets": [
"https://labs.zetachain.com/get-zeta"
@@ -39,10 +39,10 @@ export default {
},
{
"name": "ZetaChain Athens Testnet Explorer",
"url": "https://explorer.athens.zetachain.com",
"url": "https://athens3.explorer.zetachain.com",
"standard": "none"
}
],
"testnet": true,
"slug": "zetachain-athens-testnet"
"slug": "zetachain-athens-3-testnet"
} as const satisfies Chain;
+20 -1
View File
@@ -2,7 +2,19 @@ import type { Chain } from "../src/types";
export default {
"name": "Acala Network",
"chain": "ACA",
"rpc": [],
"rpc": [
"https://acala-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://eth-rpc-acala.aca-api.network",
"wss://eth-rpc-acala.aca-api.network"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [],
"nativeCurrency": {
"name": "Acala Token",
@@ -14,6 +26,13 @@ export default {
"chainId": 787,
"networkId": 787,
"slip44": 787,
"explorers": [
{
"name": "blockscout",
"url": "https://blockscout.acala.network",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "acala-network"
} as const satisfies Chain;
+1 -1
View File
@@ -4,7 +4,7 @@ export default {
"chain": "ETH",
"rpc": [
"https://base.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://developer-access-mainnet.base.org/"
"https://mainnet.base.org/"
],
"faucets": [],
"nativeCurrency": {
+39
View File
@@ -0,0 +1,39 @@
import type { Chain } from "../src/types";
export default {
"name": "IMPERIUM TESTNET",
"chain": "tIMP",
"rpc": [],
"faucets": [
"https://faucet.imperiumchain.com/"
],
"nativeCurrency": {
"name": "tIMP",
"symbol": "tIMP",
"decimals": 18
},
"infoURL": "https://imperiumchain.com",
"shortName": "tIMP",
"chainId": 9818,
"networkId": 9818,
"icon": {
"url": "ipfs://QmcNGLzKyc7Gu2dgpBFF6t3KJwFuKC79D56DW8GTc5DWRw",
"width": 200,
"height": 200,
"format": "png"
},
"explorers": [
{
"name": "IMPERIUM TESTNET Explorer",
"icon": {
"url": "ipfs://QmcNGLzKyc7Gu2dgpBFF6t3KJwFuKC79D56DW8GTc5DWRw",
"width": 200,
"height": 200,
"format": "png"
},
"url": "https://network.impscan.com",
"standard": "none"
}
],
"testnet": true,
"slug": "imperium-testnet"
} as const satisfies Chain;
+39
View File
@@ -0,0 +1,39 @@
import type { Chain } from "../src/types";
export default {
"name": "IMPERIUM MAINNET",
"chain": "IMP",
"rpc": [],
"faucets": [
"https://faucet.imperiumchain.com/"
],
"nativeCurrency": {
"name": "IMP",
"symbol": "IMP",
"decimals": 18
},
"infoURL": "https://imperiumchain.com",
"shortName": "IMP",
"chainId": 9819,
"networkId": 9819,
"icon": {
"url": "ipfs://QmcNGLzKyc7Gu2dgpBFF6t3KJwFuKC79D56DW8GTc5DWRw",
"width": 200,
"height": 200,
"format": "png"
},
"explorers": [
{
"name": "IMPERIUM Explorer",
"icon": {
"url": "ipfs://QmcNGLzKyc7Gu2dgpBFF6t3KJwFuKC79D56DW8GTc5DWRw",
"width": 200,
"height": 200,
"format": "png"
},
"url": "https://impscan.com",
"standard": "none"
}
],
"testnet": false,
"slug": "imperium"
} as const satisfies Chain;
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.39",
"version": "0.1.40",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"browser": {
@@ -27,7 +27,7 @@
"@babel/preset-env": "^7.22.9",
"@babel/preset-typescript": "^7.22.5",
"@babel/runtime": "^7.22.6",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*",
"@types/jest": "^29.5.3",
"axios": "^1.4.0",
File diff suppressed because one or more lines are too long
+19
View File
@@ -1,5 +1,24 @@
# thirdweb
## 0.11.7
### Patch Changes
- [#1419](https://github.com/thirdweb-dev/js/pull/1419) [`2b96f71e`](https://github.com/thirdweb-dev/js/commit/2b96f71e191d7f69c2c75f9c6a9ee4537bac65aa) Thanks [@Marfuen](https://github.com/Marfuen)! - Fix path of cache to work with windows.
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e)]:
- @thirdweb-dev/storage@1.2.3
- @thirdweb-dev/sdk@3.10.43
## 0.11.6
### Patch Changes
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/storage@1.2.2
- @thirdweb-dev/chains@0.1.40
- @thirdweb-dev/sdk@3.10.42
## 0.11.5
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.11.5",
"version": "0.11.7",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+1 -1
View File
@@ -26,7 +26,7 @@ const main = async () => {
const skipIntro = process.env.THIRDWEB_CLI_SKIP_INTRO === "true";
const program = new Command();
const cache = new Cache("thirdweb:cli", {
const cache = new Cache("thirdweb-cli", {
location: path.join(os.homedir(), ".thirdweb", "creds"),
});
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/pay
## 0.1.4
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
## 0.1.3
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/pay",
"version": "0.1.3",
"version": "0.1.4",
"main": "dist/thirdweb-dev-pay.cjs.js",
"module": "dist/thirdweb-dev-pay.esm.js",
"exports": {
@@ -36,7 +36,7 @@
"@coinbase/cbpay-js": "^1.7.0"
},
"devDependencies": {
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*",
"eslint-config-thirdweb": "workspace:*",
"typescript": "^5.1.6"
+28
View File
@@ -1,5 +1,33 @@
# @thirdweb-dev/react-core
## 3.14.24
### Patch Changes
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e), [`b0ec1d80`](https://github.com/thirdweb-dev/js/commit/b0ec1d80839efccad11b50afbf2216c2c132cf7e)]:
- @thirdweb-dev/storage@1.2.3
- @thirdweb-dev/wallets@1.1.7
- @thirdweb-dev/sdk@3.10.43
## 3.14.23
### Patch Changes
- Updated dependencies [[`fbde927a`](https://github.com/thirdweb-dev/js/commit/fbde927a0cb36a6269e045d8e577536f23164ef7)]:
- @thirdweb-dev/wallets@1.1.6
## 3.14.22
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/storage@1.2.2
- @thirdweb-dev/wallets@1.1.5
- @thirdweb-dev/chains@0.1.40
- @thirdweb-dev/sdk@3.10.42
## 3.14.21
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.14.21",
"version": "3.14.24",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -74,7 +74,7 @@
"@microsoft/api-documenter": "^7.22.30",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@solana/wallet-adapter-react": "^0.15.19",
"@solana/web3.js": "^1.62.0",
"@thirdweb-dev/auth": "workspace:*",
@@ -1,5 +1,11 @@
# @thirdweb-dev/react-native-compat
## 0.2.43
## 0.2.42
## 0.2.41
## 0.2.40
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.2.40",
"version": "0.2.43",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+29
View File
@@ -1,5 +1,34 @@
# @thirdweb-dev/react-native
## 0.2.43
### Patch Changes
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e), [`b0ec1d80`](https://github.com/thirdweb-dev/js/commit/b0ec1d80839efccad11b50afbf2216c2c132cf7e)]:
- @thirdweb-dev/storage@1.2.3
- @thirdweb-dev/wallets@1.1.7
- @thirdweb-dev/sdk@3.10.43
- @thirdweb-dev/react-core@3.14.24
## 0.2.42
### Patch Changes
- Updated dependencies [[`fbde927a`](https://github.com/thirdweb-dev/js/commit/fbde927a0cb36a6269e045d8e577536f23164ef7)]:
- @thirdweb-dev/wallets@1.1.6
- @thirdweb-dev/react-core@3.14.23
## 0.2.41
### Patch Changes
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/react-core@3.14.22
- @thirdweb-dev/storage@1.2.2
- @thirdweb-dev/wallets@1.1.5
- @thirdweb-dev/chains@0.1.40
- @thirdweb-dev/sdk@3.10.42
## 0.2.40
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.2.40",
"version": "0.2.43",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+29
View File
@@ -1,5 +1,34 @@
# @thirdweb-dev/react
## 3.14.24
### Patch Changes
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e), [`b0ec1d80`](https://github.com/thirdweb-dev/js/commit/b0ec1d80839efccad11b50afbf2216c2c132cf7e)]:
- @thirdweb-dev/wallets@1.1.7
- @thirdweb-dev/sdk@3.10.43
- @thirdweb-dev/react-core@3.14.24
## 3.14.23
### Patch Changes
- Updated dependencies [[`fbde927a`](https://github.com/thirdweb-dev/js/commit/fbde927a0cb36a6269e045d8e577536f23164ef7)]:
- @thirdweb-dev/wallets@1.1.6
- @thirdweb-dev/react-core@3.14.23
## 3.14.22
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/react-core@3.14.22
- @thirdweb-dev/wallets@1.1.5
- @thirdweb-dev/chains@0.1.40
- @thirdweb-dev/sdk@3.10.42
## 3.14.21
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.14.21",
"version": "3.14.24",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -89,7 +89,7 @@
"@microsoft/api-documenter": "^7.22.30",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@solana/wallet-adapter-base": "^0.9.17",
"@solana/wallet-adapter-phantom": "^0.9.17",
"@solana/wallet-adapter-react": "^0.15.19",
+19
View File
@@ -1,5 +1,24 @@
# @thirdweb-dev/sdk
## 3.10.43
### Patch Changes
- [#1411](https://github.com/thirdweb-dev/js/pull/1411) [`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e) Thanks [@jnsdls](https://github.com/jnsdls)! - add auth token
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e)]:
- @thirdweb-dev/storage@1.2.3
## 3.10.42
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/storage@1.2.2
- @thirdweb-dev/chains@0.1.40
## 3.10.41
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.10.41",
"version": "3.10.43",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
@@ -107,7 +107,7 @@
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@project-serum/anchor": "^0.25.0",
"@solana/spl-token": "^0.3.5",
"@solana/web3.js": "^1.62.0",
+7 -1
View File
@@ -158,7 +158,7 @@ export function getProviderFromRpcUrl(
chainId?: number,
) {
try {
const headers: Record<string, string> = {};
const headers: HeadersInit = {};
if (isTwUrl(rpcUrl)) {
if (sdkOptions?.clientId) {
headers["x-client-id"] = sdkOptions?.clientId;
@@ -173,6 +173,12 @@ export function getProviderFromRpcUrl(
} else if (sdkOptions?.secretKey) {
headers["x-secret-key"] = sdkOptions?.secretKey;
}
// if we have a tw auth token on global context add it to the headers
if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis) {
headers["authorization"] = `Bearer ${
(globalThis as any).TW_AUTH_TOKEN as string
}`;
}
}
const match = rpcUrl.match(/^(ws|http)s?:/i);
// Try the JSON batch provider if available
+20
View File
@@ -1,5 +1,25 @@
# @thirdweb-dev/service-utils
## 0.2.5
### Patch Changes
- [#1411](https://github.com/thirdweb-dev/js/pull/1411) [`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e) Thanks [@jnsdls](https://github.com/jnsdls)! - allow account level auth via jwt
## 0.2.4
### Patch Changes
- [#1420](https://github.com/thirdweb-dev/js/pull/1420) [`952009cd`](https://github.com/thirdweb-dev/js/commit/952009cd73a1851dfef7a8f8c29ab6d73d580508) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Handle \* domain as public
- [#1417](https://github.com/thirdweb-dev/js/pull/1417) [`580e77b1`](https://github.com/thirdweb-dev/js/commit/580e77b17088a439208bd1411c71e9fb0c2cbb79) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Return accountId from authorize service call
## 0.2.3
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
## 0.2.2
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/service-utils",
"version": "0.2.2",
"version": "0.2.5",
"main": "dist/thirdweb-dev-service-utils.cjs.js",
"module": "dist/thirdweb-dev-service-utils.esm.js",
"exports": {
@@ -40,7 +40,7 @@
"sideEffects": false,
"devDependencies": {
"@cloudflare/workers-types": "^4.20230724.0",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*",
"@types/jest": "^29.5.3",
"@types/node": "^18.17.1",
+19 -2
View File
@@ -1,5 +1,9 @@
import type { ExecutionContext, KVNamespace } from "@cloudflare/workers-types";
import type { ApiKeyMetadata, CoreServiceConfig } from "../core/api";
import type {
ApiKeyMetadata,
AccountMetadata,
CoreServiceConfig,
} from "../core/api";
import { authorize } from "../core/authorize";
import type { Request } from "@cloudflare/workers-types";
@@ -47,7 +51,7 @@ export async function authorizeWorker(
return await authorize(authData, serviceConfig, {
get: async (clientId: string) => serviceConfig.kvStore.get(clientId),
put: (clientId: string, apiKeyMeta: ApiKeyMetadata) =>
put: (clientId: string, apiKeyMeta: ApiKeyMetadata | AccountMetadata) =>
serviceConfig.ctx.waitUntil(
serviceConfig.kvStore.put(
clientId,
@@ -124,7 +128,20 @@ async function extractAuthorizationData(
clientId = derivedClientId;
}
let jwt: string | null = null;
if (headers.has("authorization")) {
const authHeader = headers.get("authorization");
if (authHeader) {
const [type, token] = authHeader.split(" ");
if (type.toLowerCase() === "bearer") {
jwt = token;
}
}
}
return {
jwt,
hashedJWT: jwt ? await hashSecretKey(jwt) : null,
secretKey,
clientId,
origin,
+36
View File
@@ -11,6 +11,7 @@ export type CoreServiceConfig = {
export type ApiKeyMetadata = {
id: string;
key: string;
accountId: string;
creatorWalletAddress: string;
secretHash: string;
walletAddresses: string[];
@@ -23,6 +24,12 @@ export type ApiKeyMetadata = {
}[];
};
export type AccountMetadata = {
id: string;
name: string;
creatorWalletAddress: string;
};
export type ApiResponse = {
data: ApiKeyMetadata | null;
error: {
@@ -32,6 +39,15 @@ export type ApiResponse = {
};
};
export type ApiAccountResponse = {
data: AccountMetadata | null;
error: {
code: string;
statusCode: number;
message: string;
};
};
export async function fetchKeyMetadataFromApi(
clientId: string,
config: CoreServiceConfig,
@@ -52,3 +68,23 @@ export async function fetchKeyMetadataFromApi(
}
return (await response.json()) as ApiResponse;
}
export async function fetchAccountFromApi(
jwt: string,
config: CoreServiceConfig,
): Promise<ApiAccountResponse> {
const { apiUrl, serviceApiKey } = config;
const url = `${apiUrl}/v1/account/me`;
const response = await fetch(url, {
method: "GET",
headers: {
"x-service-api-key": serviceApiKey,
"content-type": "application/json",
authorization: `Bearer ${jwt}`,
},
});
if (!response.ok) {
throw new Error(`Error fetching account from API: ${response.statusText}`);
}
return (await response.json()) as ApiAccountResponse;
}
@@ -17,6 +17,8 @@ describe("authorizeClient", () => {
origin: null,
bundleId: null,
secretKeyHash: null,
hashedJWT: null,
jwt: null,
},
validServiceConfig,
)) as any;
@@ -33,6 +35,8 @@ describe("authorizeClient", () => {
origin: null,
bundleId: null,
secretKeyHash: null,
hashedJWT: null,
jwt: null,
},
{ ...validServiceConfig, enforceAuth: true },
)) as any;
@@ -11,6 +11,7 @@ describe("authorizeClient", () => {
domains: ["example.com", "*.example.com"],
bundleIds: ["com.example.app"],
services: [],
accountId: "test-account-id",
};
const validAuthOptions: ClientAuthorizationPayload = {
@@ -40,6 +41,26 @@ describe("authorizeClient", () => {
expect(result.apiKeyMeta).toEqual(validApiKeyMeta);
});
it("should authorize client with any domain w/o origin check", () => {
const authOptionsWithAnyDomain: ClientAuthorizationPayload = {
secretKeyHash: null,
bundleId: null,
origin: null,
};
const validApiKeyMetaAnyDomain = {
...validApiKeyMeta,
domains: ["*"],
};
const result = authorizeClient(
authOptionsWithAnyDomain,
validApiKeyMetaAnyDomain,
) as any;
expect(result.authorized).toBe(true);
expect(result.apiKeyMeta).toEqual(validApiKeyMetaAnyDomain);
});
it("should not authorize client with non-matching bundle id", () => {
const authOptionsWithBundleId: ClientAuthorizationPayload = {
secretKeyHash: null,
@@ -14,6 +14,23 @@ export function authorizeClient(
const { origin, bundleId, secretKeyHash: providedSecretHash } = authOptions;
const { domains, bundleIds, secretHash } = apiKeyMeta;
const authResult: AuthorizationResult = {
authorized: true,
apiKeyMeta,
accountMeta: {
id: apiKeyMeta.accountId,
// TODO update this later
name: "",
creatorWalletAddress: apiKeyMeta.creatorWalletAddress,
},
};
// check for public restrictions
if (domains.includes("*")) {
return authResult;
}
// check for secretHash
if (providedSecretHash) {
if (secretHash !== providedSecretHash) {
return {
@@ -23,10 +40,8 @@ export function authorizeClient(
status: 401,
};
}
return {
authorized: true,
apiKeyMeta,
};
return authResult;
}
// validate domains
@@ -34,14 +49,22 @@ export function authorizeClient(
if (
// find matching domain, or if all domains allowed
domains.find((d) => {
// if any domain is allowed, we'll return true
if (d === "*") {
return true;
}
// special rule for `localhost`
// if the domain is localhost, we'll allow any origin that starts with localhost
if (d === "localhost" && origin.startsWith("localhost")) {
return true;
}
// If the allowedDomain has a wildcard,
// we'll check that the ending of our domain matches the wildcard
if (d.startsWith("*.")) {
const domainRoot = d.slice(2);
// get rid of the * and check if it ends with the `.<domain>.<tld>`
const domainRoot = d.slice(1);
return origin.endsWith(domainRoot);
}
@@ -49,10 +72,7 @@ export function authorizeClient(
return d === origin;
})
) {
return {
authorized: true,
apiKeyMeta,
};
return authResult;
}
return {
@@ -75,10 +95,7 @@ export function authorizeClient(
return b === bundleId;
})
) {
return {
authorized: true,
apiKeyMeta,
};
return authResult;
}
return {
@@ -1,6 +1,8 @@
import {
AccountMetadata,
ApiKeyMetadata,
CoreServiceConfig,
fetchAccountFromApi,
fetchKeyMetadataFromApi,
} from "../api";
import { authorizeClient } from "./client";
@@ -13,36 +15,124 @@ export type AuthorizationInput = {
origin: string | null;
bundleId: string | null;
secretKeyHash: string | null;
jwt: string | null;
hashedJWT: string | null;
targetAddress?: string | string[];
};
type CacheOptions = {
get: (clientId: string) => Promise<string | null>;
put: (clientId: string, data: ApiKeyMetadata) => Promise<void> | void;
put: (
clientId: string,
data: ApiKeyMetadata | AccountMetadata,
) => Promise<void> | void;
cacheTtlSeconds: number;
};
type CacheWithPossibleTtl =
type ApiKeyCacheWithPossibleTTL =
| {
apiKeyMeta: ApiKeyMetadata;
updatedAt: number;
}
| ApiKeyMetadata;
type AccountCacheWithPossibleTTL =
| {
apiKeyMeta: AccountMetadata;
updatedAt: number;
}
| AccountMetadata;
export async function authorize(
authData: AuthorizationInput,
serviceConfig: CoreServiceConfig,
cacheOptions?: CacheOptions,
): Promise<AuthorizationResult> {
const { clientId, targetAddress, secretKeyHash } = authData;
const { clientId, targetAddress, secretKeyHash, jwt, hashedJWT } = authData;
const { enforceAuth } = serviceConfig;
// BACKWARDS COMPAT: if auth not enforced and
// we don't have auth credentials bypass
// BACKWARDS COMPAT: if auth not enforced and we don't have auth credentials bypass
if (!enforceAuth && !clientId && !secretKeyHash) {
return {
authorized: true,
apiKeyMeta: null,
accountMeta: null,
};
}
// if we come in with a JWT then we only check the account is valid
if (jwt && hashedJWT) {
let accountMeta: AccountMetadata | null = null;
if (cacheOptions) {
try {
const cachedAccountInfo = await cacheOptions.get(hashedJWT);
if (cachedAccountInfo) {
const parsed = JSON.parse(
cachedAccountInfo,
) as AccountCacheWithPossibleTTL;
if ("updatedAt" in parsed) {
// we want to compare the updatedAt time to the current time
// if the difference is greater than the cacheTtl we want to ignore the cached data
const now = Date.now();
const diff = now - parsed.updatedAt;
const cacheTtl = cacheOptions.cacheTtlSeconds * 1000;
// only if the diff is less than the cacheTtl do we want to use the cached key
if (diff < cacheTtl * 1000) {
accountMeta = parsed.apiKeyMeta;
}
} else {
accountMeta = parsed;
}
}
} catch (err) {
// ignore errors, proceed as if not in cache
}
}
if (!accountMeta) {
try {
const { data, error } = await fetchAccountFromApi(jwt, serviceConfig);
if (error) {
return {
authorized: false,
errorCode: error.code,
errorMessage: error.message,
status: error.statusCode,
};
} else if (!data) {
return {
authorized: false,
errorCode: "NO_ACCOUNT",
errorMessage: "No error but also no account returned.",
status: 500,
};
}
accountMeta = data;
if (cacheOptions) {
await cacheOptions.put(hashedJWT, accountMeta);
}
} catch (err) {
console.warn("failed to fetch account from api", err);
return {
authorized: false,
status: 500,
errorMessage: "Failed to account information.",
errorCode: "FAILED_TO_ACCOUNT",
};
}
}
// if we still don't have an accountMeta at this point we can't authorize
if (!accountMeta) {
return {
authorized: false,
status: 401,
errorMessage: "Missing account information.",
errorCode: "MISSING_ACCOUNT",
};
}
// otherwise we want to return early with the accountMeta
return {
authorized: true,
apiKeyMeta: null,
accountMeta,
};
}
@@ -62,7 +152,7 @@ export async function authorize(
try {
const cachedKey = await cacheOptions.get(clientId);
if (cachedKey) {
const parsed = JSON.parse(cachedKey) as CacheWithPossibleTtl;
const parsed = JSON.parse(cachedKey) as ApiKeyCacheWithPossibleTTL;
if ("updatedAt" in parsed) {
// we want to compare the updatedAt time to the current time
// if the difference is greater than the cacheTtl we want to ignore the cached data
@@ -161,5 +251,11 @@ export async function authorize(
return {
authorized: true,
apiKeyMeta,
accountMeta: {
id: apiKeyMeta.accountId,
// TODO update this later
name: "",
creatorWalletAddress: apiKeyMeta.creatorWalletAddress,
},
};
}
@@ -10,6 +10,7 @@ describe("authorizeService", () => {
walletAddresses: [],
domains: [],
bundleIds: [],
accountId: "test-account-id",
services: [
{
name: "storage",
@@ -61,6 +61,11 @@ export function authorizeService(
return {
authorized: true,
accountMeta: {
id: apiKeyMetadata.accountId,
name: "",
creatorWalletAddress: apiKeyMetadata.creatorWalletAddress,
},
apiKeyMeta: apiKeyMetadata,
};
}
@@ -1,9 +1,10 @@
import { ApiKeyMetadata } from "../api";
import { AccountMetadata, ApiKeyMetadata } from "../api";
export type AuthorizationResult =
| {
authorized: true;
apiKeyMeta: ApiKeyMetadata | null;
accountMeta: AccountMetadata | null;
}
| {
authorized: false;
+12
View File
@@ -118,7 +118,19 @@ export function extractAuthorizationData(
clientId = derivedClientId;
}
let jwt: null | string = null;
// check for authorization header on the request
const authorizationHeader = getHeader(headers, "authorization");
if (authorizationHeader) {
const [type, token] = authorizationHeader.split(" ");
if (type.toLowerCase() === "bearer") {
jwt = token;
}
}
return {
jwt,
hashedJWT: jwt ? hashSecretKey(jwt) : null,
secretKeyHash,
secretKey,
clientId,
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/storage
## 1.2.3
### Patch Changes
- [#1411](https://github.com/thirdweb-dev/js/pull/1411) [`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e) Thanks [@jnsdls](https://github.com/jnsdls)! - add auth token
## 1.2.2
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
## 1.2.1
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/storage",
"version": "1.2.1",
"version": "1.2.3",
"main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js",
"browser": {
@@ -48,7 +48,7 @@
"@microsoft/api-documenter": "^7.22.30",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@swc-node/register": "^1.6.6",
"@thirdweb-dev/tsconfig": "workspace:*",
"@types/chai": "^4.3.5",
@@ -70,7 +70,7 @@ export class StorageDownloader implements IStorageDownloader {
console.warn(`Retrying download with backup gateway URL: ${resolvedUri}`);
}
let headers;
let headers: HeadersInit = {};
if (isTwGatewayUrl(resolvedUri)) {
if (this.secretKey) {
headers = { "x-secret-key": this.secretKey };
@@ -87,6 +87,15 @@ export class StorageDownloader implements IStorageDownloader {
"x-client-Id": this.clientId,
};
}
// if we have a authorization token on global context then add that to the headers
if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis) {
headers = {
...headers,
authorization: `Bearer ${
(globalThis as any).TW_AUTH_TOKEN as string
}`,
};
}
}
if (isTooManyRequests(resolvedUri)) {
@@ -270,18 +270,27 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
xhr.open("POST", `${TW_UPLOAD_SERVER_URL}/ipfs/upload`);
if (this.secretKey && this.clientId) {
throw new Error(
"Cannot use both secret key and client ID. Please use secretKey for server-side applications and clientId for client-side applications.",
);
}
if (this.secretKey) {
xhr.setRequestHeader("x-secret-key", this.secretKey);
} else if (this.clientId) {
xhr.setRequestHeader("x-client-id", this.clientId);
}
if (typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis) {
xhr.setRequestHeader(
"x-bundle-id",
(globalThis as any).APP_BUNDLE_ID as string,
);
}
// if we have a authorization token on global context then add that to the headers
if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis) {
xhr.setRequestHeader(
"authorization",
`Bearer ${(globalThis as any).TW_AUTH_TOKEN as string}`,
);
}
xhr.send(form as any);
});
}
@@ -295,12 +304,6 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
console.warn("The onProgress option is only supported in the browser");
}
if (this.secretKey && this.clientId) {
throw new Error(
"Cannot use both secret key and client ID. Please use secretKey for server-side applications and clientId for client-side applications.",
);
}
const headers: HeadersInit = {};
if (this.secretKey) {
headers["x-secret-key"] = this.secretKey;
@@ -308,6 +311,18 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
headers["x-client-id"] = this.clientId;
}
// if we have a bundle id on global context then add that to the headers
if (typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis) {
headers["x-bundle-id"] = (globalThis as any).APP_BUNDLE_ID as string;
}
// if we have a authorization token on global context then add that to the headers
if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis) {
headers["authorization"] = `Bearer ${
(globalThis as any).TW_AUTH_TOKEN as string
}`;
}
const res = await fetch(`${TW_UPLOAD_SERVER_URL}/ipfs/upload`, {
method: "POST",
headers: {
+30
View File
@@ -1,5 +1,35 @@
# @thirdweb-dev/unity-js-bridge
## 0.2.61
### Patch Changes
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e), [`b0ec1d80`](https://github.com/thirdweb-dev/js/commit/b0ec1d80839efccad11b50afbf2216c2c132cf7e)]:
- @thirdweb-dev/storage@1.2.3
- @thirdweb-dev/wallets@1.1.7
- @thirdweb-dev/sdk@3.10.43
- @thirdweb-dev/auth@3.2.24
## 0.2.60
### Patch Changes
- Updated dependencies [[`fbde927a`](https://github.com/thirdweb-dev/js/commit/fbde927a0cb36a6269e045d8e577536f23164ef7)]:
- @thirdweb-dev/wallets@1.1.6
- @thirdweb-dev/auth@3.2.23
## 0.2.59
### Patch Changes
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/storage@1.2.2
- @thirdweb-dev/wallets@1.1.5
- @thirdweb-dev/chains@0.1.40
- @thirdweb-dev/auth@3.2.22
- @thirdweb-dev/pay@0.1.4
- @thirdweb-dev/sdk@3.10.42
## 0.2.58
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.58",
"version": "0.2.61",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+5
View File
@@ -2,5 +2,10 @@
"presets": [
"@babel/preset-typescript",
["@babel/preset-env", { "targets": "defaults, not ie 11" }]
],
"plugins": [
"@babel/plugin-transform-flow-strip-types",
"@babel/plugin-transform-private-methods",
"@babel/plugin-proposal-class-properties"
]
}
+27
View File
@@ -1,5 +1,32 @@
# @thirdweb-dev/wallets
## 1.1.7
### Patch Changes
- [#1411](https://github.com/thirdweb-dev/js/pull/1411) [`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e) Thanks [@jnsdls](https://github.com/jnsdls)! - add auth token
- [#1425](https://github.com/thirdweb-dev/js/pull/1425) [`b0ec1d80`](https://github.com/thirdweb-dev/js/commit/b0ec1d80839efccad11b50afbf2216c2c132cf7e) Thanks [@iketw](https://github.com/iketw)! - Adding plugin-transform-flow-strip-types plugin to solve issues with RN FlatList
- Updated dependencies [[`3b6b0746`](https://github.com/thirdweb-dev/js/commit/3b6b0746b3fc792f4c5092814a7abfabcbc9801e)]:
- @thirdweb-dev/sdk@3.10.43
## 1.1.6
### Patch Changes
- [#1421](https://github.com/thirdweb-dev/js/pull/1421) [`fbde927a`](https://github.com/thirdweb-dev/js/commit/fbde927a0cb36a6269e045d8e577536f23164ef7) Thanks [@iketw](https://github.com/iketw)! - Add private methods transform plugin to the wallets package for ReactNative support
## 1.1.5
### Patch Changes
- [#1415](https://github.com/thirdweb-dev/js/pull/1415) [`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade preconstruct to 2.7.0
- Updated dependencies [[`256ee0d5`](https://github.com/thirdweb-dev/js/commit/256ee0d5ec9c8598aa79cd4cb1fd839c6cc7d390)]:
- @thirdweb-dev/chains@0.1.40
- @thirdweb-dev/sdk@3.10.42
## 1.1.4
### Patch Changes
+5 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "1.1.4",
"version": "1.1.7",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
@@ -396,8 +396,11 @@
},
"devDependencies": {
"@aws-sdk/client-secrets-manager": "^3.378.0",
"@babel/plugin-transform-flow-strip-types": "^7.22.5",
"@babel/plugin-transform-private-methods": "7.22.5",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@noble/ed25519": "^1.7.1",
"@preconstruct/cli": "^2.8.1",
"@preconstruct/cli": "2.7.0",
"@solana/web3.js": "^1.62.0",
"@thirdweb-dev/tsconfig": "workspace:*",
"@types/crypto-js": "^4.1.1",
@@ -45,6 +45,12 @@ export class HttpRpcClient {
headers["x-bundle-id"] = (globalThis as any).APP_BUNDLE_ID as string;
}
}
if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis) {
headers["authorization"] = `Bearer ${
(globalThis as any).TW_AUTH_TOKEN as string
}`;
}
}
this.userOpJsonRpcProvider = new providers.JsonRpcProvider(
@@ -34,12 +34,6 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
};
if (isTwUrl(this.paymasterUrl)) {
if (this.secretKey && this.clientId) {
throw new Error(
"Cannot use both secret key and client ID. Please use secretKey for server-side applications and clientId for client-side applications.",
);
}
if (this.secretKey) {
headers["x-secret-key"] = this.secretKey;
} else if (this.clientId) {
@@ -52,6 +46,11 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
headers["x-bundle-id"] = (globalThis as any).APP_BUNDLE_ID as string;
}
}
if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis) {
headers["authorization"] = `Bearer ${
(globalThis as any).TW_AUTH_TOKEN as string
}`;
}
}
// Ask the paymaster to sign the transaction and return a valid paymasterAndData value.
+2682 -284
View File
File diff suppressed because it is too large Load Diff