Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8696199849 | ||
|
|
05353fd8da | ||
|
|
baa87a1fbd | ||
|
|
407932680f | ||
|
|
6bec17c07a | ||
|
|
c379d19dfb | ||
|
|
3e2bec8a47 | ||
|
|
8b028c29d5 | ||
|
|
cc286841e2 | ||
|
|
576d968a89 | ||
|
|
f2bdf47b4f | ||
|
|
b92d3f7006 | ||
|
|
c9457bc2e7 | ||
|
|
3308bddd70 |
@@ -22,7 +22,7 @@ jobs:
|
||||
id: validate_user
|
||||
if: ${{ steps.check.outputs.triggered == 'true' }}
|
||||
run: |
|
||||
if [[ "${AUTHOR_ASSOCIATION}" != 'MEMBER' && "${AUTHOR_ASSOCIATION}" != 'OWNER' ]]
|
||||
if [[ "${AUTHOR_ASSOCIATION}" != 'MEMBER' && "${AUTHOR_ASSOCIATION}" != 'OWNER' && "${AUTHOR_ASSOCIATION}" != 'CONTRIBUTOR' ]]
|
||||
then
|
||||
echo "User authorization failed"
|
||||
exit 1
|
||||
@@ -59,6 +59,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: true
|
||||
repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }}
|
||||
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }}
|
||||
|
||||
- name: Install
|
||||
uses: ./.github/composite-actions/install
|
||||
@@ -74,7 +75,7 @@ jobs:
|
||||
|
||||
- name: Deploy pre-release
|
||||
run: |
|
||||
yarn changeset version --snapshot pr${{ github.event.issue.number }}
|
||||
yarn changeset publish --tag pr${{ github.event.issue.number }} --no-git-tag
|
||||
yarn changeset version --snapshot dev
|
||||
yarn changeset publish --tag dev --no-git-tag
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
|
||||
| Package | Description | Latest Version |
|
||||
| ---------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [/sdk](./packages/sdk/README.md) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react](./packages/react/README.md) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/auth](./packages/auth/README.md) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/storage](./packages/storage/README.md) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/cli](./packages/cli/README.md) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/solana](./packages/solana/README.md) | Solana SDK for Browser, Node and React Native | <a href="https://www.npmjs.com/package/@thirdweb-dev/solana"><img src="https://img.shields.io/npm/v/@thirdweb-dev/solana?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/sdk](./packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react](./packages/react) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/auth](./packages/auth) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/storage](./packages/storage) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/cli](./packages/cli) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/solana](./packages/solana) | Solana SDK for Browser, Node and React Native | <a href="https://www.npmjs.com/package/@thirdweb-dev/solana"><img src="https://img.shields.io/npm/v/@thirdweb-dev/solana?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
|
||||
## How this monorepo functions
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69), [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339), [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30)]:
|
||||
- @thirdweb-dev/sdk@2.4.9
|
||||
|
||||
## 1.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
"./express": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.7.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69), [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339), [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30)]:
|
||||
- @thirdweb-dev/sdk@2.4.9
|
||||
|
||||
## 0.7.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.7.9",
|
||||
"version": "0.7.10",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -51,7 +51,6 @@ export interface ERC721MultiwrapInterface extends utils.Interface {
|
||||
"TRANSFER_ROLE()": FunctionFragment;
|
||||
"approve(address,uint256)": FunctionFragment;
|
||||
"balanceOf(address)": FunctionFragment;
|
||||
"bundle(uint256)": FunctionFragment;
|
||||
"contractURI()": FunctionFragment;
|
||||
"getApproved(uint256)": FunctionFragment;
|
||||
"getDefaultRoyaltyInfo()": FunctionFragment;
|
||||
@@ -101,7 +100,6 @@ export interface ERC721MultiwrapInterface extends utils.Interface {
|
||||
| "TRANSFER_ROLE"
|
||||
| "approve"
|
||||
| "balanceOf"
|
||||
| "bundle"
|
||||
| "contractURI"
|
||||
| "getApproved"
|
||||
| "getDefaultRoyaltyInfo"
|
||||
@@ -158,10 +156,6 @@ export interface ERC721MultiwrapInterface extends utils.Interface {
|
||||
values: [string, BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(functionFragment: "balanceOf", values: [string]): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "bundle",
|
||||
values: [BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "contractURI",
|
||||
values?: undefined
|
||||
@@ -325,7 +319,6 @@ export interface ERC721MultiwrapInterface extends utils.Interface {
|
||||
): Result;
|
||||
decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result;
|
||||
decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result;
|
||||
decodeFunctionResult(functionFragment: "bundle", data: BytesLike): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "contractURI",
|
||||
data: BytesLike
|
||||
@@ -680,11 +673,6 @@ export interface ERC721Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<[BigNumber]>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<[string]>;
|
||||
|
||||
getApproved(
|
||||
@@ -916,11 +904,6 @@ export interface ERC721Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<string>;
|
||||
|
||||
getApproved(
|
||||
@@ -1146,11 +1129,6 @@ export interface ERC721Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<string>;
|
||||
|
||||
getApproved(
|
||||
@@ -1506,8 +1484,6 @@ export interface ERC721Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
bundle(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
getApproved(
|
||||
@@ -1746,11 +1722,6 @@ export interface ERC721Multiwrap extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||
|
||||
getApproved(
|
||||
|
||||
@@ -50,7 +50,6 @@ export interface MultiwrapInterface extends utils.Interface {
|
||||
"DEFAULT_ADMIN_ROLE()": FunctionFragment;
|
||||
"approve(address,uint256)": FunctionFragment;
|
||||
"balanceOf(address)": FunctionFragment;
|
||||
"bundle(uint256)": FunctionFragment;
|
||||
"contractType()": FunctionFragment;
|
||||
"contractURI()": FunctionFragment;
|
||||
"contractVersion()": FunctionFragment;
|
||||
@@ -101,7 +100,6 @@ export interface MultiwrapInterface extends utils.Interface {
|
||||
| "DEFAULT_ADMIN_ROLE"
|
||||
| "approve"
|
||||
| "balanceOf"
|
||||
| "bundle"
|
||||
| "contractType"
|
||||
| "contractURI"
|
||||
| "contractVersion"
|
||||
@@ -156,10 +154,6 @@ export interface MultiwrapInterface extends utils.Interface {
|
||||
values: [string, BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(functionFragment: "balanceOf", values: [string]): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "bundle",
|
||||
values: [BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "contractType",
|
||||
values?: undefined
|
||||
@@ -327,7 +321,6 @@ export interface MultiwrapInterface extends utils.Interface {
|
||||
): Result;
|
||||
decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result;
|
||||
decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result;
|
||||
decodeFunctionResult(functionFragment: "bundle", data: BytesLike): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "contractType",
|
||||
data: BytesLike
|
||||
@@ -672,11 +665,6 @@ export interface Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<[BigNumber]>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
contractType(overrides?: CallOverrides): Promise<[string]>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<[string]>;
|
||||
@@ -922,11 +910,6 @@ export interface Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
contractType(overrides?: CallOverrides): Promise<string>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<string>;
|
||||
@@ -1162,11 +1145,6 @@ export interface Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
contractType(overrides?: CallOverrides): Promise<string>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<string>;
|
||||
@@ -1527,8 +1505,6 @@ export interface Multiwrap extends BaseContract {
|
||||
|
||||
balanceOf(owner: string, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
bundle(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
contractType(overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<BigNumber>;
|
||||
@@ -1777,11 +1753,6 @@ export interface Multiwrap extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
contractType(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||
|
||||
contractURI(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||
|
||||
@@ -51,7 +51,6 @@ export interface PackInterface extends utils.Interface {
|
||||
"addPackContents(uint256,(address,uint8,uint256,uint256)[],uint256[],address)": FunctionFragment;
|
||||
"balanceOf(address,uint256)": FunctionFragment;
|
||||
"balanceOfBatch(address[],uint256[])": FunctionFragment;
|
||||
"bundle(uint256)": FunctionFragment;
|
||||
"canUpdatePack(uint256)": FunctionFragment;
|
||||
"contractType()": FunctionFragment;
|
||||
"contractURI()": FunctionFragment;
|
||||
@@ -60,6 +59,8 @@ export interface PackInterface extends utils.Interface {
|
||||
"getDefaultRoyaltyInfo()": FunctionFragment;
|
||||
"getPackContents(uint256)": FunctionFragment;
|
||||
"getRoleAdmin(bytes32)": FunctionFragment;
|
||||
"getRoleMember(bytes32,uint256)": FunctionFragment;
|
||||
"getRoleMemberCount(bytes32)": FunctionFragment;
|
||||
"getRoyaltyInfoForToken(uint256)": FunctionFragment;
|
||||
"getTokenCountOfBundle(uint256)": FunctionFragment;
|
||||
"getTokenOfBundle(uint256,uint256)": FunctionFragment;
|
||||
@@ -100,7 +101,6 @@ export interface PackInterface extends utils.Interface {
|
||||
| "addPackContents"
|
||||
| "balanceOf"
|
||||
| "balanceOfBatch"
|
||||
| "bundle"
|
||||
| "canUpdatePack"
|
||||
| "contractType"
|
||||
| "contractURI"
|
||||
@@ -109,6 +109,8 @@ export interface PackInterface extends utils.Interface {
|
||||
| "getDefaultRoyaltyInfo"
|
||||
| "getPackContents"
|
||||
| "getRoleAdmin"
|
||||
| "getRoleMember"
|
||||
| "getRoleMemberCount"
|
||||
| "getRoyaltyInfoForToken"
|
||||
| "getTokenCountOfBundle"
|
||||
| "getTokenOfBundle"
|
||||
@@ -159,10 +161,6 @@ export interface PackInterface extends utils.Interface {
|
||||
functionFragment: "balanceOfBatch",
|
||||
values: [string[], BigNumberish[]]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "bundle",
|
||||
values: [BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "canUpdatePack",
|
||||
values: [BigNumberish]
|
||||
@@ -202,6 +200,14 @@ export interface PackInterface extends utils.Interface {
|
||||
functionFragment: "getRoleAdmin",
|
||||
values: [BytesLike]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "getRoleMember",
|
||||
values: [BytesLike, BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "getRoleMemberCount",
|
||||
values: [BytesLike]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "getRoyaltyInfoForToken",
|
||||
values: [BigNumberish]
|
||||
@@ -329,7 +335,6 @@ export interface PackInterface extends utils.Interface {
|
||||
functionFragment: "balanceOfBatch",
|
||||
data: BytesLike
|
||||
): Result;
|
||||
decodeFunctionResult(functionFragment: "bundle", data: BytesLike): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "canUpdatePack",
|
||||
data: BytesLike
|
||||
@@ -359,6 +364,14 @@ export interface PackInterface extends utils.Interface {
|
||||
functionFragment: "getRoleAdmin",
|
||||
data: BytesLike
|
||||
): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "getRoleMember",
|
||||
data: BytesLike
|
||||
): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "getRoleMemberCount",
|
||||
data: BytesLike
|
||||
): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "getRoyaltyInfoForToken",
|
||||
data: BytesLike
|
||||
@@ -705,11 +718,6 @@ export interface Pack extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber[]]>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
canUpdatePack(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -745,6 +753,17 @@ export interface Pack extends BaseContract {
|
||||
|
||||
getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise<[string]>;
|
||||
|
||||
getRoleMember(
|
||||
role: BytesLike,
|
||||
index: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[string] & { member: string }>;
|
||||
|
||||
getRoleMemberCount(
|
||||
role: BytesLike,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber] & { count: BigNumber }>;
|
||||
|
||||
getRoyaltyInfoForToken(
|
||||
_tokenId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -952,11 +971,6 @@ export interface Pack extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber[]>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
canUpdatePack(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -992,6 +1006,17 @@ export interface Pack extends BaseContract {
|
||||
|
||||
getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise<string>;
|
||||
|
||||
getRoleMember(
|
||||
role: BytesLike,
|
||||
index: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<string>;
|
||||
|
||||
getRoleMemberCount(
|
||||
role: BytesLike,
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber>;
|
||||
|
||||
getRoyaltyInfoForToken(
|
||||
_tokenId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -1204,11 +1229,6 @@ export interface Pack extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber[]>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
canUpdatePack(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -1246,6 +1266,17 @@ export interface Pack extends BaseContract {
|
||||
|
||||
getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise<string>;
|
||||
|
||||
getRoleMember(
|
||||
role: BytesLike,
|
||||
index: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<string>;
|
||||
|
||||
getRoleMemberCount(
|
||||
role: BytesLike,
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber>;
|
||||
|
||||
getRoyaltyInfoForToken(
|
||||
_tokenId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -1600,8 +1631,6 @@ export interface Pack extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber>;
|
||||
|
||||
bundle(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
canUpdatePack(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -1635,6 +1664,17 @@ export interface Pack extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber>;
|
||||
|
||||
getRoleMember(
|
||||
role: BytesLike,
|
||||
index: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber>;
|
||||
|
||||
getRoleMemberCount(
|
||||
role: BytesLike,
|
||||
overrides?: CallOverrides
|
||||
): Promise<BigNumber>;
|
||||
|
||||
getRoyaltyInfoForToken(
|
||||
_tokenId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -1843,11 +1883,6 @@ export interface Pack extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
canUpdatePack(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -1883,6 +1918,17 @@ export interface Pack extends BaseContract {
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
getRoleMember(
|
||||
role: BytesLike,
|
||||
index: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
getRoleMemberCount(
|
||||
role: BytesLike,
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
getRoyaltyInfoForToken(
|
||||
_tokenId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
|
||||
@@ -40,7 +40,6 @@ export declare namespace ITokenBundle {
|
||||
|
||||
export interface TokenBundleInterface extends utils.Interface {
|
||||
functions: {
|
||||
"bundle(uint256)": FunctionFragment;
|
||||
"getTokenCountOfBundle(uint256)": FunctionFragment;
|
||||
"getTokenOfBundle(uint256,uint256)": FunctionFragment;
|
||||
"getUriOfBundle(uint256)": FunctionFragment;
|
||||
@@ -48,16 +47,11 @@ export interface TokenBundleInterface extends utils.Interface {
|
||||
|
||||
getFunction(
|
||||
nameOrSignatureOrTopic:
|
||||
| "bundle"
|
||||
| "getTokenCountOfBundle"
|
||||
| "getTokenOfBundle"
|
||||
| "getUriOfBundle"
|
||||
): FunctionFragment;
|
||||
|
||||
encodeFunctionData(
|
||||
functionFragment: "bundle",
|
||||
values: [BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "getTokenCountOfBundle",
|
||||
values: [BigNumberish]
|
||||
@@ -71,7 +65,6 @@ export interface TokenBundleInterface extends utils.Interface {
|
||||
values: [BigNumberish]
|
||||
): string;
|
||||
|
||||
decodeFunctionResult(functionFragment: "bundle", data: BytesLike): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "getTokenCountOfBundle",
|
||||
data: BytesLike
|
||||
@@ -115,11 +108,6 @@ export interface TokenBundle extends BaseContract {
|
||||
removeListener: OnEvent<this>;
|
||||
|
||||
functions: {
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -137,11 +125,6 @@ export interface TokenBundle extends BaseContract {
|
||||
): Promise<[string]>;
|
||||
};
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -159,11 +142,6 @@ export interface TokenBundle extends BaseContract {
|
||||
): Promise<string>;
|
||||
|
||||
callStatic: {
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -184,8 +162,6 @@ export interface TokenBundle extends BaseContract {
|
||||
filters: {};
|
||||
|
||||
estimateGas: {
|
||||
bundle(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -204,11 +180,6 @@ export interface TokenBundle extends BaseContract {
|
||||
};
|
||||
|
||||
populateTransaction: {
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
|
||||
@@ -42,7 +42,6 @@ export declare namespace ITokenBundle {
|
||||
|
||||
export interface TokenStoreInterface extends utils.Interface {
|
||||
functions: {
|
||||
"bundle(uint256)": FunctionFragment;
|
||||
"getTokenCountOfBundle(uint256)": FunctionFragment;
|
||||
"getTokenOfBundle(uint256,uint256)": FunctionFragment;
|
||||
"getUriOfBundle(uint256)": FunctionFragment;
|
||||
@@ -54,7 +53,6 @@ export interface TokenStoreInterface extends utils.Interface {
|
||||
|
||||
getFunction(
|
||||
nameOrSignatureOrTopic:
|
||||
| "bundle"
|
||||
| "getTokenCountOfBundle"
|
||||
| "getTokenOfBundle"
|
||||
| "getUriOfBundle"
|
||||
@@ -64,10 +62,6 @@ export interface TokenStoreInterface extends utils.Interface {
|
||||
| "supportsInterface"
|
||||
): FunctionFragment;
|
||||
|
||||
encodeFunctionData(
|
||||
functionFragment: "bundle",
|
||||
values: [BigNumberish]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "getTokenCountOfBundle",
|
||||
values: [BigNumberish]
|
||||
@@ -97,7 +91,6 @@ export interface TokenStoreInterface extends utils.Interface {
|
||||
values: [BytesLike]
|
||||
): string;
|
||||
|
||||
decodeFunctionResult(functionFragment: "bundle", data: BytesLike): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "getTokenCountOfBundle",
|
||||
data: BytesLike
|
||||
@@ -157,11 +150,6 @@ export interface TokenStore extends BaseContract {
|
||||
removeListener: OnEvent<this>;
|
||||
|
||||
functions: {
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -210,11 +198,6 @@ export interface TokenStore extends BaseContract {
|
||||
): Promise<[boolean]>;
|
||||
};
|
||||
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -263,11 +246,6 @@ export interface TokenStore extends BaseContract {
|
||||
): Promise<boolean>;
|
||||
|
||||
callStatic: {
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string] & { count: BigNumber; uri: string }>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -319,8 +297,6 @@ export interface TokenStore extends BaseContract {
|
||||
filters: {};
|
||||
|
||||
estimateGas: {
|
||||
bundle(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
@@ -370,11 +346,6 @@ export interface TokenStore extends BaseContract {
|
||||
};
|
||||
|
||||
populateTransaction: {
|
||||
bundle(
|
||||
arg0: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
getTokenCountOfBundle(
|
||||
_bundleId: BigNumberish,
|
||||
overrides?: CallOverrides
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -8,30 +8,6 @@ import type { Provider } from "@ethersproject/providers";
|
||||
import { Contract, Signer, utils } from "ethers";
|
||||
|
||||
const _abi = [
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: "uint256",
|
||||
name: "",
|
||||
type: "uint256",
|
||||
},
|
||||
],
|
||||
name: "bundle",
|
||||
outputs: [
|
||||
{
|
||||
internalType: "uint256",
|
||||
name: "count",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
internalType: "string",
|
||||
name: "uri",
|
||||
type: "string",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
type: "function",
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
|
||||
@@ -19,30 +19,6 @@ const _abi = [
|
||||
stateMutability: "nonpayable",
|
||||
type: "constructor",
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: "uint256",
|
||||
name: "",
|
||||
type: "uint256",
|
||||
},
|
||||
],
|
||||
name: "bundle",
|
||||
outputs: [
|
||||
{
|
||||
internalType: "uint256",
|
||||
name: "count",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
internalType: "string",
|
||||
name: "uri",
|
||||
type: "string",
|
||||
},
|
||||
],
|
||||
stateMutability: "view",
|
||||
type: "function",
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
@@ -261,7 +237,7 @@ const _abi = [
|
||||
];
|
||||
|
||||
const _bytecode =
|
||||
"0x60a060405234801561001057600080fd5b5060405161090738038061090783398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161087f6100886000396000505061087f6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806361195e941161005b57806361195e941461012d578063bc197c811461014d578063d0d2fe251461016c578063f23a6e611461019a57600080fd5b806301ffc9a71461008d57806313578f26146100b5578063150b7a02146100d65780631da799c91461010d575b600080fd5b6100a061009b3660046103eb565b6101b9565b60405190151581526020015b60405180910390f35b6100c86100c336600461041c565b6101f0565b6040516100ac929190610482565b6100f46100e4366004610576565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016100ac565b61012061011b3660046105de565b610295565b6040516100ac9190610616565b61014061013b36600461041c565b610346565b6040516100ac919061066c565b6100f461015b3660046106ff565b63bc197c8160e01b95945050505050565b61018c61017a36600461041c565b60009081526020819052604090205490565b6040519081526020016100ac565b6100f46101a83660046107a9565b63f23a6e6160e01b95945050505050565b60006001600160e01b03198216630271189760e51b14806101ea57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600060208190529081526040902080546001820180549192916102129061080e565b80601f016020809104026020016040519081016040528092919081815260200182805461023e9061080e565b801561028b5780601f106102605761010080835404028352916020019161028b565b820191906000526020600020905b81548152906001019060200180831161026e57829003601f168201915b5050505050905082565b6102c1604080516080810190915260008082526020820190815260200160008152602001600081525090565b600083815260208181526040808320858452600290810183529281902081516080810190925280546001600160a01b038116835291939092840191600160a01b900460ff169081111561031657610316610600565b600281111561032757610327610600565b8152600182015460208201526002909101546040909101529392505050565b60008181526020819052604090206001018054606091906103669061080e565b80601f01602080910402602001604051908101604052809291908181526020018280546103929061080e565b80156103df5780601f106103b4576101008083540402835291602001916103df565b820191906000526020600020905b8154815290600101906020018083116103c257829003601f168201915b50505050509050919050565b6000602082840312156103fd57600080fd5b81356001600160e01b03198116811461041557600080fd5b9392505050565b60006020828403121561042e57600080fd5b5035919050565b6000815180845260005b8181101561045b5760208185018101518683018201520161043f565b8181111561046d576000602083870101525b50601f01601f19169290920160200192915050565b82815260406020820152600061049b6040830184610435565b949350505050565b80356001600160a01b03811681146104ba57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156104fe576104fe6104bf565b604052919050565b600082601f83011261051757600080fd5b813567ffffffffffffffff811115610531576105316104bf565b610544601f8201601f19166020016104d5565b81815284602083860101111561055957600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561058c57600080fd5b610595856104a3565b93506105a3602086016104a3565b925060408501359150606085013567ffffffffffffffff8111156105c657600080fd5b6105d287828801610506565b91505092959194509250565b600080604083850312156105f157600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b81516001600160a01b03168152602082015160808201906003811061064b57634e487b7160e01b600052602160045260246000fd5b80602084015250604083015160408301526060830151606083015292915050565b6020815260006104156020830184610435565b600082601f83011261069057600080fd5b8135602067ffffffffffffffff8211156106ac576106ac6104bf565b8160051b6106bb8282016104d5565b92835284810182019282810190878511156106d557600080fd5b83870192505b848310156106f4578235825291830191908301906106db565b979650505050505050565b600080600080600060a0868803121561071757600080fd5b610720866104a3565b945061072e602087016104a3565b9350604086013567ffffffffffffffff8082111561074b57600080fd5b61075789838a0161067f565b9450606088013591508082111561076d57600080fd5b61077989838a0161067f565b9350608088013591508082111561078f57600080fd5b5061079c88828901610506565b9150509295509295909350565b600080600080600060a086880312156107c157600080fd5b6107ca866104a3565b94506107d8602087016104a3565b93506040860135925060608601359150608086013567ffffffffffffffff81111561080257600080fd5b61079c88828901610506565b600181811c9082168061082257607f821691505b6020821081141561084357634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220324cd20076ad68aa254becad4b9035c8aeb9c4049f395a2e323eafa4e4b4b6a864736f6c634300080c0033";
|
||||
"0x60a060405234801561001057600080fd5b5060405161080a38038061080a83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610782610088600039600050506107826000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806361195e941161005b57806361195e9414610101578063bc197c8114610121578063d0d2fe2514610140578063f23a6e611461016e57600080fd5b806301ffc9a714610082578063150b7a02146100aa5780631da799c9146100e1575b600080fd5b61009561009036600461031a565b61018d565b60405190151581526020015b60405180910390f35b6100c86100b836600461041e565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016100a1565b6100f46100ef366004610486565b6101c4565b6040516100a191906104be565b61011461010f366004610514565b610275565b6040516100a1919061052d565b6100c861012f366004610602565b63bc197c8160e01b95945050505050565b61016061014e366004610514565b60009081526020819052604090205490565b6040519081526020016100a1565b6100c861017c3660046106ac565b63f23a6e6160e01b95945050505050565b60006001600160e01b03198216630271189760e51b14806101be57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6101f0604080516080810190915260008082526020820190815260200160008152602001600081525090565b600083815260208181526040808320858452600290810183529281902081516080810190925280546001600160a01b038116835291939092840191600160a01b900460ff1690811115610245576102456104a8565b6002811115610256576102566104a8565b8152600182015460208201526002909101546040909101529392505050565b600081815260208190526040902060010180546060919061029590610711565b80601f01602080910402602001604051908101604052809291908181526020018280546102c190610711565b801561030e5780601f106102e35761010080835404028352916020019161030e565b820191906000526020600020905b8154815290600101906020018083116102f157829003601f168201915b50505050509050919050565b60006020828403121561032c57600080fd5b81356001600160e01b03198116811461034457600080fd5b9392505050565b80356001600160a01b038116811461036257600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156103a6576103a6610367565b604052919050565b600082601f8301126103bf57600080fd5b813567ffffffffffffffff8111156103d9576103d9610367565b6103ec601f8201601f191660200161037d565b81815284602083860101111561040157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561043457600080fd5b61043d8561034b565b935061044b6020860161034b565b925060408501359150606085013567ffffffffffffffff81111561046e57600080fd5b61047a878288016103ae565b91505092959194509250565b6000806040838503121561049957600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b81516001600160a01b0316815260208201516080820190600381106104f357634e487b7160e01b600052602160045260246000fd5b80602084015250604083015160408301526060830151606083015292915050565b60006020828403121561052657600080fd5b5035919050565b600060208083528351808285015260005b8181101561055a5785810183015185820160400152820161053e565b8181111561056c576000604083870101525b50601f01601f1916929092016040019392505050565b600082601f83011261059357600080fd5b8135602067ffffffffffffffff8211156105af576105af610367565b8160051b6105be82820161037d565b92835284810182019282810190878511156105d857600080fd5b83870192505b848310156105f7578235825291830191908301906105de565b979650505050505050565b600080600080600060a0868803121561061a57600080fd5b6106238661034b565b94506106316020870161034b565b9350604086013567ffffffffffffffff8082111561064e57600080fd5b61065a89838a01610582565b9450606088013591508082111561067057600080fd5b61067c89838a01610582565b9350608088013591508082111561069257600080fd5b5061069f888289016103ae565b9150509295509295909350565b600080600080600060a086880312156106c457600080fd5b6106cd8661034b565b94506106db6020870161034b565b93506040860135925060608601359150608086013567ffffffffffffffff81111561070557600080fd5b61069f888289016103ae565b600181811c9082168061072557607f821691505b6020821081141561074657634e487b7160e01b600052602260045260246000fd5b5091905056fea264697066735822122063ab22b3a48b1c53655cbbcd318d8135a52905b628edc24f4e92b2d632f6938b64736f6c634300080c0033";
|
||||
|
||||
type TokenStoreConstructorParams =
|
||||
| [signer?: Signer]
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 2.9.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69), [`f2bdf47`](https://github.com/thirdweb-dev/js/commit/f2bdf47b4fd06433be367c9aac6d11a8dbbf1a1a), [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339), [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30)]:
|
||||
- @thirdweb-dev/sdk@2.4.9
|
||||
- @thirdweb-dev/storage@0.2.8
|
||||
|
||||
## 2.9.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "2.9.6",
|
||||
"version": "2.9.7",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 2.4.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#74](https://github.com/thirdweb-dev/js/pull/74) [`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69) Thanks [@nkrishang](https://github.com/nkrishang)! - Updated forwarder address for Goerli
|
||||
|
||||
- [#75](https://github.com/thirdweb-dev/js/pull/75) [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339) Thanks [@jnsdls](https://github.com/jnsdls)! - add a default for factory deployments initializer function ("initialize")
|
||||
|
||||
- [#71](https://github.com/thirdweb-dev/js/pull/71) [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Allow for chain agnostic gasless tx
|
||||
|
||||
- Updated dependencies [[`f2bdf47`](https://github.com/thirdweb-dev/js/commit/f2bdf47b4fd06433be367c9aac6d11a8dbbf1a1a)]:
|
||||
- @thirdweb-dev/storage@0.2.8
|
||||
|
||||
## 2.4.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "2.4.8",
|
||||
"version": "2.4.9",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -12,6 +12,16 @@ export const ForwardRequest = [
|
||||
{ name: "data", type: "bytes" },
|
||||
];
|
||||
|
||||
export const ChainAwareForwardRequest = [
|
||||
{ name: "from", type: "address" },
|
||||
{ name: "to", type: "address" },
|
||||
{ name: "value", type: "uint256" },
|
||||
{ name: "gas", type: "uint256" },
|
||||
{ name: "nonce", type: "uint256" },
|
||||
{ name: "data", type: "bytes" },
|
||||
{ name: "chainid", type: "uint256" },
|
||||
];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ethers, Signer, providers } from "ethers";
|
||||
export interface EIP712StandardDomain {
|
||||
name: string;
|
||||
version: string;
|
||||
chainId: number;
|
||||
chainId?: number;
|
||||
verifyingContract: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const OZ_DEFENDER_FORWARDER_ADDRESS =
|
||||
|
||||
const TWRegistry_address = "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd";
|
||||
const TWFactory_address = "0x5DBC7B840baa9daBcBe9D2492E45D7244B54A2A0";
|
||||
const ContractPublisher_address = "0x58c892e6bc196371f7fb425177b0E2aA906BC007"; // Polygon only
|
||||
const ContractPublisher_address = "0x664244560eBa21Bf82d7150C791bE1AbcD5B4cd7"; // Polygon only
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -17,6 +17,7 @@ const ContractPublisher_address = "0x58c892e6bc196371f7fb425177b0E2aA906BC007";
|
||||
export const CONTRACT_ADDRESSES: Record<
|
||||
SUPPORTED_CHAIN_ID,
|
||||
{
|
||||
openzeppelinForwarder: string;
|
||||
biconomyForwarder: string;
|
||||
twFactory: string;
|
||||
twRegistry: string;
|
||||
@@ -24,90 +25,105 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
}
|
||||
> = {
|
||||
[ChainId.Mainnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x84a0856b038eaAd1cC7E297cF34A7e72685A8693",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.Rinkeby]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0xFD4973FeB2031D4409fB57afEE5dF2051b171104",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3E6eE864f850F5e5A98bc950B68E181Cf4010F23",
|
||||
},
|
||||
[ChainId.Goerli]: {
|
||||
openzeppelinForwarder: "0x5001A14CA6163143316a7C614e30e6041033Ac20",
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0xB1Bd9d7942A250BA2Dce27DD601F2ED4211A60C4",
|
||||
},
|
||||
[ChainId.Polygon]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x86C80a8aa58e0A4fa09A69624c31Ab2a6CAD56b8",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x308473Be900F4185A56587dE54bDFF5E8f7a6AE7",
|
||||
},
|
||||
[ChainId.Mumbai]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x9399BB24DBB5C4b782C70c2969F58716Ebbd6a3b",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3F17972CB27506eb4a6a3D59659e0B57a43fd16C",
|
||||
},
|
||||
[ChainId.Avalanche]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x64CD353384109423a966dCd3Aa30D884C9b2E057",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.AvalancheFujiTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x6271Ca63D30507f2Dcbf99B52787032506D75BBF",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3E6eE864f850F5e5A98bc950B68E181Cf4010F23",
|
||||
},
|
||||
[ChainId.Fantom]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0x97EA0Fcc552D5A8Fb5e9101316AAd0D62Ea0876B",
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.FantomTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3E6eE864f850F5e5A98bc950B68E181Cf4010F23",
|
||||
},
|
||||
[ChainId.Arbitrum]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.ArbitrumTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xb0435b47ad26115A39c59735b814f3769F07C2c1",
|
||||
twRegistry: "0xcF4c511551aE4dab1F997866FC3900cd2aaeC40D",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.Optimism]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.OptimismTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.BinanceSmartChainMainnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
},
|
||||
[ChainId.BinanceSmartChainTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { convertToTWError } from "../../common";
|
||||
import {
|
||||
BiconomyForwarderAbi,
|
||||
ChainAwareForwardRequest,
|
||||
ForwardRequest,
|
||||
getAndIncrementNonce,
|
||||
} from "../../common/forwarder";
|
||||
@@ -8,7 +9,7 @@ import { getPolygonGasPriorityFee } from "../../common/gas-price";
|
||||
import { signEIP2612Permit } from "../../common/permit";
|
||||
import { signTypedDataInternal } from "../../common/sign";
|
||||
import { isBrowser } from "../../common/utils";
|
||||
import { ChainId } from "../../constants";
|
||||
import { CONTRACT_ADDRESSES, ChainId } from "../../constants";
|
||||
import { getContractAddressByChainId } from "../../constants/addresses";
|
||||
import { EventType } from "../../constants/events";
|
||||
import { SDKOptions } from "../../schema/sdk-options";
|
||||
@@ -264,17 +265,6 @@ export class ContractWrapper<
|
||||
args: any[],
|
||||
callOverrides?: CallOverrides,
|
||||
): Promise<providers.TransactionReceipt> {
|
||||
// one time verification that this is a valid contract (to avoid sending funds to wrong addresses)
|
||||
if (!this.isValidContract) {
|
||||
const code = await this.getProvider().getCode(this.readContract.address);
|
||||
this.isValidContract = code !== "0x";
|
||||
if (!this.isValidContract) {
|
||||
throw new Error(
|
||||
"The address you're trying to send a transaction to is not a smart contract. Make sure you are on the correct network and the contract address is correct",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!callOverrides) {
|
||||
callOverrides = await this.getCallOverrides();
|
||||
}
|
||||
@@ -297,6 +287,18 @@ export class ContractWrapper<
|
||||
this.emitTransactionEvent("completed", txHash);
|
||||
return receipt;
|
||||
} else {
|
||||
// one time verification that this is a valid contract (to avoid sending funds to wrong addresses)
|
||||
if (!this.isValidContract) {
|
||||
const code = await this.getProvider().getCode(
|
||||
this.readContract.address,
|
||||
);
|
||||
this.isValidContract = code !== "0x";
|
||||
if (!this.isValidContract) {
|
||||
throw new Error(
|
||||
"The address you're trying to send a transaction to is not a smart contract. Make sure you are on the correct network and the contract address is correct",
|
||||
);
|
||||
}
|
||||
}
|
||||
const tx = await this.sendTransactionByFunction(
|
||||
fn as keyof TContract["functions"],
|
||||
args,
|
||||
@@ -375,9 +377,8 @@ export class ContractWrapper<
|
||||
let gas = gasEstimate.mul(2);
|
||||
|
||||
// in some cases WalletConnect doesn't properly gives an estimate for how much gas it would actually use.
|
||||
// it'd estimate ~21740 on polygon.
|
||||
// as a fix, we're setting it to a high arbitrary number (500k) as the gas limit that should cover for most function calls.
|
||||
if (gasEstimate.lt(25000)) {
|
||||
if (gasEstimate.lt(50000)) {
|
||||
gas = BigNumber.from(500000);
|
||||
}
|
||||
|
||||
@@ -561,37 +562,60 @@ export class ContractWrapper<
|
||||
): Promise<string> {
|
||||
invariant(
|
||||
this.options.gasless && "openzeppelin" in this.options.gasless,
|
||||
"calling biconomySendFunction without biconomy",
|
||||
"calling openzeppelin gasless transaction without openzeppelin config in the SDK options",
|
||||
);
|
||||
const signer = this.getSigner();
|
||||
const provider = this.getProvider();
|
||||
invariant(signer, "provider is not set");
|
||||
invariant(provider, "provider is not set");
|
||||
const forwarderAddress =
|
||||
this.options.gasless.openzeppelin.relayerForwarderAddress;
|
||||
this.options.gasless.openzeppelin.relayerForwarderAddress ||
|
||||
CONTRACT_ADDRESSES[transaction.chainId as keyof typeof CONTRACT_ADDRESSES]
|
||||
.openzeppelinForwarder;
|
||||
const forwarder = Forwarder__factory.connect(forwarderAddress, provider);
|
||||
const nonce = await getAndIncrementNonce(forwarder, "getNonce", [
|
||||
transaction.from,
|
||||
]);
|
||||
const domain = {
|
||||
name: "GSNv2 Forwarder",
|
||||
version: "0.0.1",
|
||||
chainId: transaction.chainId,
|
||||
verifyingContract: forwarderAddress,
|
||||
};
|
||||
|
||||
const types = {
|
||||
ForwardRequest,
|
||||
};
|
||||
|
||||
let message: ForwardRequestMessage | PermitRequestMessage = {
|
||||
from: transaction.from,
|
||||
to: transaction.to,
|
||||
value: BigNumber.from(0).toString(),
|
||||
gas: BigNumber.from(transaction.gasLimit).toString(),
|
||||
nonce: BigNumber.from(nonce).toString(),
|
||||
data: transaction.data,
|
||||
};
|
||||
let domain;
|
||||
let types;
|
||||
let message: ForwardRequestMessage | PermitRequestMessage;
|
||||
if (this.options.gasless.experimentalChainlessSupport) {
|
||||
domain = {
|
||||
name: "GSNv2 Forwarder",
|
||||
version: "0.0.1",
|
||||
verifyingContract: forwarderAddress,
|
||||
};
|
||||
types = {
|
||||
ForwardRequest: ChainAwareForwardRequest,
|
||||
};
|
||||
message = {
|
||||
from: transaction.from,
|
||||
to: transaction.to,
|
||||
value: BigNumber.from(0).toString(),
|
||||
gas: BigNumber.from(transaction.gasLimit).toString(),
|
||||
nonce: BigNumber.from(nonce).toString(),
|
||||
data: transaction.data,
|
||||
chainid: BigNumber.from(transaction.chainId).toString(),
|
||||
};
|
||||
} else {
|
||||
domain = {
|
||||
name: "GSNv2 Forwarder",
|
||||
version: "0.0.1",
|
||||
chainId: transaction.chainId,
|
||||
verifyingContract: forwarderAddress,
|
||||
};
|
||||
types = {
|
||||
ForwardRequest,
|
||||
};
|
||||
message = {
|
||||
from: transaction.from,
|
||||
to: transaction.to,
|
||||
value: BigNumber.from(0).toString(),
|
||||
gas: BigNumber.from(transaction.gasLimit).toString(),
|
||||
nonce: BigNumber.from(nonce).toString(),
|
||||
data: transaction.data,
|
||||
};
|
||||
}
|
||||
|
||||
let signature: BytesLike;
|
||||
|
||||
|
||||
@@ -79,9 +79,6 @@ export class DelayedReveal<
|
||||
* realNFTs,
|
||||
* "my secret password",
|
||||
* );
|
||||
* // Whenever you're ready, reveal your NFTs at any time!
|
||||
* const batchId = 0; // the batch to reveal
|
||||
* await contract.revealer.reveal(batchId, "my secret password");
|
||||
* ```
|
||||
* @public
|
||||
* @param placeholder - the placeholder NFT to show before the reveal
|
||||
|
||||
@@ -11,6 +11,15 @@ import { BigNumberish, ethers } from "ethers";
|
||||
import { TransactionResult } from "../types";
|
||||
import { TransactionTask } from "./TransactionTask";
|
||||
|
||||
/**
|
||||
* Configure and claim ERC1155 NFTs
|
||||
* @remarks Manage claim phases and claim ERC1155 NFTs that have been lazily minted.
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contract = await sdk.getContract("{{contract_address}}");
|
||||
* await contract.edition.drop.claim.to("0x...", tokenId, quantity);
|
||||
* ```
|
||||
*/
|
||||
export class Erc1155Claimable implements DetectableFeature {
|
||||
featureName = FEATURE_NFT_CLAIMABLE.name;
|
||||
|
||||
|
||||
@@ -107,6 +107,16 @@ export class Erc1155Mintable implements DetectableFeature {
|
||||
* @param to - the address to mint to
|
||||
* @param tokenId - the token id of the NFT to increase supply of
|
||||
* @param additionalSupply - the additional amount to mint
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Address of the wallet you want to mint the NFT to
|
||||
* const toAddress = "{{wallet_address}}"
|
||||
* const tokenId = 0;
|
||||
* const additionalSupply = 1000;
|
||||
*
|
||||
* const tx = await contract.edition.mint.additionalSupplyTo(toAddress, tokenId, additionalSupply);
|
||||
* ```
|
||||
*/
|
||||
public async additionalSupplyTo(
|
||||
to: string,
|
||||
|
||||
@@ -257,8 +257,11 @@ export class ContractFactory extends ContractWrapper<TWFactory> {
|
||||
const biconomyForwarder = chainEnum
|
||||
? CONTRACT_ADDRESSES[chainEnum].biconomyForwarder
|
||||
: constants.AddressZero;
|
||||
const openzeppelinForwarder = chainEnum
|
||||
? CONTRACT_ADDRESSES[chainEnum].openzeppelinForwarder
|
||||
: constants.AddressZero;
|
||||
return biconomyForwarder !== constants.AddressZero
|
||||
? [OZ_DEFENDER_FORWARDER_ADDRESS, biconomyForwarder]
|
||||
: [OZ_DEFENDER_FORWARDER_ADDRESS];
|
||||
? [openzeppelinForwarder, biconomyForwarder]
|
||||
: [openzeppelinForwarder];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,6 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
* Get an instance of a SignatureDrop contract
|
||||
* @param contractAddress - the address of the deployed contract
|
||||
* @returns the contract
|
||||
* @internal
|
||||
*/
|
||||
public getSignatureDrop(contractAddress: string): SignatureDrop {
|
||||
return this.getBuiltInContract(
|
||||
@@ -361,6 +360,10 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
/**
|
||||
* Return all the contracts deployed by the specified address
|
||||
* @param walletAddress - the deployed address
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contracts = sdk.getContractList("{{wallet_address}}");
|
||||
* ```
|
||||
*/
|
||||
public async getContractList(walletAddress: string) {
|
||||
const addresses = await (
|
||||
@@ -431,6 +434,10 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
* @param address - the address of the deployed contract
|
||||
* @returns the contract
|
||||
* @beta
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contract = sdk.getContract("{{contract_address}}");
|
||||
* ```
|
||||
*/
|
||||
public async getContract(address: string) {
|
||||
if (this.contractCache.has(address)) {
|
||||
@@ -460,6 +467,17 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
* @param abi - the JSON abi
|
||||
* @returns the contract
|
||||
* @beta
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Import your ABI from a JSON file
|
||||
* import myABI from "./path/to/myABI.json";
|
||||
*
|
||||
* const contract = sdk.getContractFromAbi(
|
||||
* "{{contract_address}}",
|
||||
* // Pass in the "abi" field from the JSON file
|
||||
* myABI.abi
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
public getContractFromAbi(address: string, abi: ContractInterface) {
|
||||
if (this.contractCache.has(address)) {
|
||||
|
||||
@@ -81,6 +81,7 @@ export type ForwardRequestMessage = {
|
||||
gas: string;
|
||||
nonce: string;
|
||||
data: BytesLike;
|
||||
chainid?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,7 +115,7 @@ export const ChainIdToAddressSchema = z.record(z.string(), z.string());
|
||||
*/
|
||||
export const FactoryDeploymentSchema = z.object({
|
||||
implementationAddresses: ChainIdToAddressSchema,
|
||||
implementationInitializerFunction: z.string(),
|
||||
implementationInitializerFunction: z.string().default("initialize"),
|
||||
factoryAddresses: ChainIdToAddressSchema,
|
||||
});
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@ export const SDKOptionsSchema = z
|
||||
relayerUrl: z.string().url(),
|
||||
relayerForwarderAddress: z
|
||||
.string()
|
||||
.default(OZ_DEFENDER_FORWARDER_ADDRESS),
|
||||
.optional(),
|
||||
}),
|
||||
experimentalChainlessSupport: z.boolean().default(false),
|
||||
}),
|
||||
z.object({
|
||||
biconomy: z.object({
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# @thirdweb-dev/solana
|
||||
|
||||
## 0.2.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#63](https://github.com/thirdweb-dev/js/pull/63) [`f2bdf47`](https://github.com/thirdweb-dev/js/commit/f2bdf47b4fd06433be367c9aac6d11a8dbbf1a1a) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Create and manage Tokens
|
||||
|
||||
- Updated dependencies [[`f2bdf47`](https://github.com/thirdweb-dev/js/commit/f2bdf47b4fd06433be367c9aac6d11a8dbbf1a1a)]:
|
||||
- @thirdweb-dev/storage@0.2.8
|
||||
|
||||
## 0.2.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/solana",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.7",
|
||||
"description": "thirdweb Solana SDK",
|
||||
"main": "dist/thirdweb-dev-solana.cjs.js",
|
||||
"module": "dist/thirdweb-dev-solana.esm.js",
|
||||
@@ -9,8 +9,8 @@
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "tsc && preconstruct build",
|
||||
"amman:start": "DEBUG='amman:(info|error|debug)' amman start",
|
||||
"amman:stop": "amman stop",
|
||||
"node:start": "DEBUG='amman:(info|error|debug)' amman start",
|
||||
"node:stop": "amman stop",
|
||||
"test:all": "ts-mocha --paths -t 120000 -r esm -p tsconfig.testing.json './test/**/*.test.ts'",
|
||||
"test": "make test",
|
||||
"test:single": "ts-mocha --paths -t 120000 -r esm -p tsconfig.testing.json"
|
||||
|
||||
@@ -5,6 +5,6 @@ set -e
|
||||
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
|
||||
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
|
||||
solana --version
|
||||
yarn run amman:start
|
||||
yarn run node:start
|
||||
yarn run test:all
|
||||
yarn run amman:stop
|
||||
yarn run node:stop
|
||||
@@ -1,9 +1,16 @@
|
||||
import { NFTCollectionMetadataInput } from "../types/contracts";
|
||||
import {
|
||||
NFTCollectionMetadataInput,
|
||||
TokenMetadataInput,
|
||||
TokenMetadataInputSchema,
|
||||
} from "../types/contracts";
|
||||
import { UserWallet } from "./user-wallet";
|
||||
import { Metaplex } from "@metaplex-foundation/js";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { findMetadataPda, Metaplex, token } from "@metaplex-foundation/js";
|
||||
import {
|
||||
createCreateMetadataAccountV2Instruction,
|
||||
DataV2,
|
||||
} from "@metaplex-foundation/mpl-token-metadata";
|
||||
import { Keypair, PublicKey } from "@solana/web3.js";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
export class Deployer {
|
||||
private wallet: UserWallet;
|
||||
@@ -16,10 +23,62 @@ export class Deployer {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
async createToken(tokenMetadata: TokenMetadataInput): Promise<string> {
|
||||
const tokenMetadataParsed = TokenMetadataInputSchema.parse(tokenMetadata);
|
||||
const uri = await this.storage.uploadMetadata(tokenMetadataParsed);
|
||||
const owner = this.wallet.getSigner().publicKey;
|
||||
const mint = Keypair.generate();
|
||||
const mintTx = await this.metaplex
|
||||
.tokens()
|
||||
.builders()
|
||||
.createTokenWithMint({
|
||||
decimals: tokenMetadataParsed.decimals,
|
||||
initialSupply: token(
|
||||
tokenMetadataParsed.initialSupply,
|
||||
tokenMetadataParsed.decimals,
|
||||
),
|
||||
mint,
|
||||
mintAuthority: this.wallet.getSigner(),
|
||||
payer: this.wallet.getSigner(),
|
||||
owner,
|
||||
});
|
||||
|
||||
const data: DataV2 = {
|
||||
name: tokenMetadataParsed.name,
|
||||
symbol: tokenMetadataParsed.symbol || "",
|
||||
sellerFeeBasisPoints: 0,
|
||||
uri,
|
||||
creators: [
|
||||
{
|
||||
address: owner,
|
||||
share: 100,
|
||||
verified: false,
|
||||
},
|
||||
],
|
||||
collection: null,
|
||||
uses: null,
|
||||
};
|
||||
const metadata = findMetadataPda(mint.publicKey);
|
||||
const metaTx = createCreateMetadataAccountV2Instruction(
|
||||
{
|
||||
metadata,
|
||||
mint: mint.publicKey,
|
||||
mintAuthority: owner,
|
||||
payer: owner,
|
||||
updateAuthority: owner,
|
||||
},
|
||||
{ createMetadataAccountArgsV2: { data, isMutable: false } },
|
||||
);
|
||||
await mintTx
|
||||
.add({ instruction: metaTx, signers: [this.wallet.getSigner()] })
|
||||
.sendAndConfirm(this.metaplex);
|
||||
|
||||
return mint.publicKey.toBase58();
|
||||
}
|
||||
|
||||
async createNftCollection(
|
||||
collectionMetadata: NFTCollectionMetadataInput,
|
||||
): Promise<string> {
|
||||
invariant(this.wallet.signer, "Wallet is not connected");
|
||||
const uri = await this.storage.uploadMetadata(collectionMetadata);
|
||||
|
||||
const { nft: collectionNft } = await this.metaplex
|
||||
@@ -30,9 +89,9 @@ export class Deployer {
|
||||
sellerFeeBasisPoints: 0,
|
||||
uri,
|
||||
isCollection: true,
|
||||
collectionAuthority: this.wallet.signer,
|
||||
updateAuthority: this.wallet.signer,
|
||||
mintAuthority: this.wallet.signer,
|
||||
collectionAuthority: this.wallet.getSigner(),
|
||||
updateAuthority: this.wallet.getSigner(),
|
||||
mintAuthority: this.wallet.getSigner(),
|
||||
creators: collectionMetadata.creators?.map((creator) => ({
|
||||
address: new PublicKey(creator.address),
|
||||
share: creator.share,
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import { UserWallet } from "../classes/user-wallet";
|
||||
import { METAPLEX_PROGRAM_ID } from "../constants/addresses";
|
||||
import { NFTMetadataInput } from "../types/nft";
|
||||
import { Metaplex, token } from "@metaplex-foundation/js";
|
||||
import { TransactionResult } from "../types/common";
|
||||
import { NFTMetadata, NFTMetadataInput } from "../types/nft";
|
||||
import {
|
||||
Metaplex,
|
||||
Nft,
|
||||
NftWithToken,
|
||||
Sft,
|
||||
SftWithToken,
|
||||
token,
|
||||
} from "@metaplex-foundation/js";
|
||||
import { Metadata } from "@metaplex-foundation/mpl-token-metadata";
|
||||
import { getAccount, getAssociatedTokenAddress } from "@solana/spl-token";
|
||||
import { ConfirmedSignatureInfo, Connection, PublicKey } from "@solana/web3.js";
|
||||
@@ -27,14 +35,16 @@ export class NFTCollection {
|
||||
this.collectionMintAddress = new PublicKey(collectionMintAddress);
|
||||
}
|
||||
|
||||
async getCollectionInfo() {
|
||||
return await this.metaplex
|
||||
async getCollectionInfo(): Promise<NFTMetadata> {
|
||||
const meta = await this.metaplex
|
||||
.nfts()
|
||||
.findByMint({ mintAddress: this.collectionMintAddress })
|
||||
.run(); // TODO abstract types away
|
||||
.run();
|
||||
// TODO Make a alias type for this specific to collections
|
||||
return this.toNFTMetadata(meta);
|
||||
}
|
||||
|
||||
async mint(metadata: NFTMetadataInput) {
|
||||
async mint(metadata: NFTMetadataInput): Promise<string> {
|
||||
const uri = await this.storage.uploadMetadata(metadata);
|
||||
const { nft: mintedNFT } = await this.metaplex
|
||||
.nfts()
|
||||
@@ -46,19 +56,24 @@ export class NFTCollection {
|
||||
collectionAuthority: this.wallet.signer,
|
||||
})
|
||||
.run();
|
||||
return mintedNFT;
|
||||
return mintedNFT.address.toBase58();
|
||||
}
|
||||
|
||||
async transfer(receiverAddress: string, mintAddress: string) {
|
||||
const nftToSend = await this.get(mintAddress);
|
||||
return await this.metaplex
|
||||
async transfer(
|
||||
receiverAddress: string,
|
||||
mintAddress: string,
|
||||
): Promise<TransactionResult> {
|
||||
const result = await this.metaplex
|
||||
.nfts()
|
||||
.send({
|
||||
mintAddress: new PublicKey(mintAddress),
|
||||
toOwner: new PublicKey(receiverAddress),
|
||||
amount: token(1, 0, nftToSend.symbol),
|
||||
amount: token(1, 0),
|
||||
})
|
||||
.run();
|
||||
return {
|
||||
signature: result.response.signature,
|
||||
};
|
||||
}
|
||||
|
||||
async balanceOf(walletAddress: string, mintAddress: string): Promise<bigint> {
|
||||
@@ -74,13 +89,14 @@ export class NFTCollection {
|
||||
}
|
||||
}
|
||||
|
||||
async get(mintAddress: string) {
|
||||
return await this.metaplex
|
||||
async get(mintAddress: string): Promise<NFTMetadata> {
|
||||
const meta = await this.metaplex
|
||||
.nfts()
|
||||
.findByMint({
|
||||
mintAddress: new PublicKey(mintAddress),
|
||||
})
|
||||
.run(); // TODO abstract types away
|
||||
.run();
|
||||
return this.toNFTMetadata(meta);
|
||||
}
|
||||
|
||||
async getAll(): Promise<string[]> {
|
||||
@@ -159,4 +175,14 @@ export class NFTCollection {
|
||||
}
|
||||
return Array.from(mintAddresses);
|
||||
}
|
||||
|
||||
private toNFTMetadata(meta: Nft | Sft | NftWithToken | SftWithToken) {
|
||||
return {
|
||||
id: meta.address.toBase58(),
|
||||
uri: meta.uri,
|
||||
name: meta.name,
|
||||
symbol: meta.symbol,
|
||||
...meta.json,
|
||||
} as NFTMetadata;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
import { UserWallet } from "../classes/user-wallet";
|
||||
import { Amount, AmountSchema, TransactionResult } from "../types/common";
|
||||
import { TokenMetadata } from "../types/nft";
|
||||
import {
|
||||
findMetadataPda,
|
||||
Metaplex,
|
||||
token,
|
||||
toMetadata,
|
||||
toMetadataAccount,
|
||||
} from "@metaplex-foundation/js";
|
||||
import { getAccount, getAssociatedTokenAddress } from "@solana/spl-token";
|
||||
import { Connection, PublicKey } from "@solana/web3.js";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
|
||||
export class Token {
|
||||
private connection: Connection;
|
||||
private wallet: UserWallet;
|
||||
private metaplex: Metaplex;
|
||||
private storage: IStorage;
|
||||
tokenMintAddress: PublicKey;
|
||||
|
||||
constructor(
|
||||
tokenMintAddress: string,
|
||||
metaplex: Metaplex,
|
||||
wallet: UserWallet,
|
||||
storage: IStorage,
|
||||
) {
|
||||
this.wallet = wallet;
|
||||
this.storage = storage;
|
||||
this.metaplex = metaplex;
|
||||
this.connection = metaplex.connection;
|
||||
this.tokenMintAddress = new PublicKey(tokenMintAddress);
|
||||
}
|
||||
|
||||
async getMint() {
|
||||
return await this.metaplex
|
||||
.tokens()
|
||||
.findMintByAddress({ address: this.tokenMintAddress })
|
||||
.run(); // TODO abstract types away
|
||||
}
|
||||
|
||||
async getMetadata(): Promise<TokenMetadata> {
|
||||
const addr = findMetadataPda(this.tokenMintAddress);
|
||||
const account = await this.metaplex.rpc().getAccount(addr);
|
||||
const meta = toMetadata(toMetadataAccount(account));
|
||||
return {
|
||||
id: meta.address.toBase58(),
|
||||
uri: meta.uri,
|
||||
name: meta.name,
|
||||
symbol: meta.symbol,
|
||||
...meta.json,
|
||||
} as TokenMetadata;
|
||||
}
|
||||
|
||||
async totalSupply(): Promise<BigInt> {
|
||||
const info = await this.getMint();
|
||||
const value = BigInt(info.supply.basisPoints.toString());
|
||||
// TODO use CurrencyValue to provide a human readable display value
|
||||
return value;
|
||||
}
|
||||
|
||||
async mint(amount: Amount) {
|
||||
const amountParsed = AmountSchema.parse(amount);
|
||||
const info = await this.getMint();
|
||||
const result = await this.metaplex
|
||||
.tokens()
|
||||
.mint({
|
||||
amount: token(amountParsed, info.decimals),
|
||||
mintAddress: this.tokenMintAddress,
|
||||
})
|
||||
.run();
|
||||
return {
|
||||
signature: result.response.signature,
|
||||
};
|
||||
}
|
||||
|
||||
async transfer(
|
||||
receiverAddress: string,
|
||||
amount: Amount,
|
||||
): Promise<TransactionResult> {
|
||||
const info = await this.getMint();
|
||||
const result = await this.metaplex
|
||||
.tokens()
|
||||
.send({
|
||||
mintAddress: this.tokenMintAddress,
|
||||
amount: token(amount, info.decimals),
|
||||
toOwner: new PublicKey(receiverAddress),
|
||||
})
|
||||
.run();
|
||||
return {
|
||||
signature: result.response.signature,
|
||||
};
|
||||
}
|
||||
|
||||
async balance(): Promise<bigint> {
|
||||
return this.balanceOf(this.wallet.getSigner().publicKey.toBase58());
|
||||
}
|
||||
|
||||
async balanceOf(walletAddress: string): Promise<bigint> {
|
||||
const addr = await getAssociatedTokenAddress(
|
||||
this.tokenMintAddress,
|
||||
new PublicKey(walletAddress),
|
||||
);
|
||||
try {
|
||||
const account = await getAccount(this.connection, addr);
|
||||
return account.amount;
|
||||
} catch (e) {
|
||||
return 0n;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Deployer } from "./classes/deployer";
|
||||
import { UserWallet } from "./classes/user-wallet";
|
||||
import { DEFAULT_IPFS_GATEWAY } from "./constants/urls";
|
||||
import { NFTCollection } from "./contracts/nft-collection";
|
||||
import { Token } from "./contracts/token";
|
||||
import { Network } from "./types";
|
||||
import { getUrlForNetwork } from "./utils/urls";
|
||||
import {
|
||||
@@ -8,19 +10,15 @@ import {
|
||||
isKeypairSigner,
|
||||
keypairIdentity,
|
||||
Metaplex,
|
||||
mockStorage,
|
||||
Signer,
|
||||
walletAdapterIdentity,
|
||||
} from "@metaplex-foundation/js";
|
||||
import { Connection, Keypair } from "@solana/web3.js";
|
||||
import { IpfsStorage, IStorage } from "@thirdweb-dev/storage";
|
||||
import { IpfsStorage, IStorage, PinataUploader } from "@thirdweb-dev/storage";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
export class ThirdwebSDK {
|
||||
static fromNetwork(
|
||||
network: Network,
|
||||
storage: IStorage = new IpfsStorage(),
|
||||
): ThirdwebSDK {
|
||||
static fromNetwork(network: Network, storage?: IStorage): ThirdwebSDK {
|
||||
return new ThirdwebSDK(new Connection(getUrlForNetwork(network)), storage);
|
||||
}
|
||||
|
||||
@@ -31,7 +29,16 @@ export class ThirdwebSDK {
|
||||
public deployer: Deployer;
|
||||
public wallet: UserWallet;
|
||||
|
||||
constructor(connection: Connection, storage: IStorage = new IpfsStorage()) {
|
||||
constructor(
|
||||
connection: Connection,
|
||||
storage: IStorage = new IpfsStorage(
|
||||
DEFAULT_IPFS_GATEWAY,
|
||||
new PinataUploader(),
|
||||
{
|
||||
appendGatewayUrl: true,
|
||||
},
|
||||
),
|
||||
) {
|
||||
this.connection = connection;
|
||||
this.storage = storage;
|
||||
this.metaplex = Metaplex.make(this.connection);
|
||||
@@ -52,6 +59,10 @@ export class ThirdwebSDK {
|
||||
return new NFTCollection(address, this.metaplex, this.wallet, this.storage);
|
||||
}
|
||||
|
||||
public async getToken(address: string): Promise<Token> {
|
||||
return new Token(address, this.metaplex, this.wallet, this.storage);
|
||||
}
|
||||
|
||||
private propagateSignerUpdated(signer: Signer) {
|
||||
this.metaplex = this.connectToMetaplex(signer, this.metaplex);
|
||||
}
|
||||
|
||||
@@ -46,3 +46,23 @@ export type BufferOrStringWithName = {
|
||||
name?: string;
|
||||
};
|
||||
export type FileOrBuffer = Buffer | BufferOrStringWithName;
|
||||
|
||||
export const AmountSchema = z
|
||||
.union([
|
||||
z.string().regex(/^([0-9]+\.?[0-9]*|\.[0-9]+)$/, "Invalid amount"),
|
||||
z.number().min(0, "Amount cannot be negative"),
|
||||
])
|
||||
.transform((arg) => (typeof arg === "number" ? arg.toString() : arg));
|
||||
|
||||
export type Amount = z.input<typeof AmountSchema>;
|
||||
|
||||
export const CurrencyValueSchema = z.object({
|
||||
value: z.bigint(),
|
||||
displayValue: z.string(),
|
||||
});
|
||||
|
||||
export type CurrencyValue = z.input<typeof CurrencyValueSchema>;
|
||||
|
||||
export type TransactionResult = {
|
||||
signature: string;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { JsonSchema } from "./common";
|
||||
import { AmountSchema, JsonSchema } from "./common";
|
||||
import { FileBufferOrStringSchema } from "@thirdweb-dev/storage";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -20,6 +20,8 @@ export const CommonContractOutputSchema = CommonContractSchema.extend({
|
||||
image: z.string().optional(),
|
||||
}).catchall(z.lazy(() => JsonSchema));
|
||||
|
||||
/// NFT ///
|
||||
|
||||
export const NFTCollectionCreatorInputSchema = z.object({
|
||||
address: z.string(),
|
||||
share: z.number(),
|
||||
@@ -32,3 +34,12 @@ export const NFTCollectionMetadataInputSchema = CommonContractSchema.extend({
|
||||
export type NFTCollectionMetadataInput = z.input<
|
||||
typeof NFTCollectionMetadataInputSchema
|
||||
>;
|
||||
|
||||
/// TOKEN ///
|
||||
|
||||
export const TokenMetadataInputSchema = CommonContractSchema.extend({
|
||||
decimals: z.number().default(9),
|
||||
initialSupply: AmountSchema,
|
||||
});
|
||||
|
||||
export type TokenMetadataInput = z.input<typeof TokenMetadataInputSchema>;
|
||||
|
||||
@@ -8,6 +8,7 @@ import { z } from "zod";
|
||||
export const CommonTokenInput = z
|
||||
.object({
|
||||
name: z.string().optional(),
|
||||
symbol: z.string().optional(),
|
||||
description: z.string().nullable().optional(),
|
||||
image: FileBufferOrStringSchema.nullable().optional(),
|
||||
external_url: FileBufferOrStringSchema.nullable().optional(),
|
||||
@@ -45,6 +46,10 @@ export const CommonNFTOutput = CommonTokenOutput.extend({
|
||||
animation_url: z.string().nullable().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type TokenMetadata = z.output<typeof CommonTokenOutput>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { METAPLEX_PROGRAM_ID } from "../src/constants/addresses";
|
||||
import { ThirdwebSDK } from "../src/sdk";
|
||||
import { MockStorage } from "./mock/MockStorage";
|
||||
import { Amman } from "@metaplex-foundation/amman-client";
|
||||
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
||||
import { Connection, Keypair } from "@solana/web3.js";
|
||||
|
||||
const createTestSDK = async (
|
||||
solsToAirdrop: number = 100,
|
||||
): Promise<ThirdwebSDK> => {
|
||||
const connection = new Connection("http://localhost:8899", "confirmed");
|
||||
const sdk = new ThirdwebSDK(connection, new MockStorage());
|
||||
const wallet = Keypair.generate();
|
||||
const amman = Amman.instance({
|
||||
knownLabels: {
|
||||
[METAPLEX_PROGRAM_ID]: "Token Metadata",
|
||||
[TOKEN_PROGRAM_ID.toBase58()]: "Token",
|
||||
},
|
||||
});
|
||||
await amman.airdrop(connection, wallet.publicKey, solsToAirdrop);
|
||||
sdk.wallet.connect(wallet);
|
||||
return sdk;
|
||||
};
|
||||
|
||||
let sdk: ThirdwebSDK;
|
||||
|
||||
before(async () => {
|
||||
sdk = await createTestSDK();
|
||||
});
|
||||
|
||||
export { sdk };
|
||||
@@ -1,35 +1,12 @@
|
||||
import { MockStorage } from "../../sdk/test/mock/MockStorage";
|
||||
import { METAPLEX_PROGRAM_ID } from "../src/constants/addresses";
|
||||
import { NFTCollection } from "../src/contracts/nft-collection";
|
||||
import { ThirdwebSDK } from "../src/sdk";
|
||||
import { Amman } from "@metaplex-foundation/amman-client";
|
||||
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
||||
import { Connection, Keypair } from "@solana/web3.js";
|
||||
import { sdk } from "./before-setup";
|
||||
import { Keypair } from "@solana/web3.js";
|
||||
import { expect } from "chai";
|
||||
|
||||
const createTestSDK = async (
|
||||
solsToAirdrop: number = 100,
|
||||
): Promise<ThirdwebSDK> => {
|
||||
const connection = new Connection("http://localhost:8899");
|
||||
const sdk = new ThirdwebSDK(connection, new MockStorage());
|
||||
const wallet = Keypair.generate();
|
||||
const amman = Amman.instance({
|
||||
knownLabels: {
|
||||
[METAPLEX_PROGRAM_ID]: "Token Metadata",
|
||||
[TOKEN_PROGRAM_ID.toBase58()]: "Token",
|
||||
},
|
||||
});
|
||||
await amman.airdrop(connection, wallet.publicKey, solsToAirdrop);
|
||||
sdk.wallet.connect(wallet);
|
||||
return sdk;
|
||||
};
|
||||
|
||||
describe("NFTCollection", async () => {
|
||||
let sdk: ThirdwebSDK;
|
||||
let collection: NFTCollection;
|
||||
|
||||
before(async () => {
|
||||
sdk = await createTestSDK();
|
||||
const addr = await sdk.deployer.createNftCollection({
|
||||
name: "Test Collection",
|
||||
description: "Test Description",
|
||||
@@ -43,7 +20,8 @@ describe("NFTCollection", async () => {
|
||||
name: "Test NFT",
|
||||
description: "Test Description",
|
||||
});
|
||||
expect(mint.name).to.eq("Test NFT");
|
||||
const nft = await collection.get(mint);
|
||||
expect(nft.name).to.eq("Test NFT");
|
||||
});
|
||||
|
||||
it("should fetch NFTs", async () => {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Token } from "../src/contracts/token";
|
||||
import { sdk } from "./before-setup";
|
||||
import { Keypair } from "@solana/web3.js";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Token", async () => {
|
||||
let token: Token;
|
||||
|
||||
before(async () => {
|
||||
const tokenAddr = await sdk.deployer.createToken({
|
||||
name: "My Token",
|
||||
initialSupply: 100,
|
||||
});
|
||||
token = await sdk.getToken(tokenAddr);
|
||||
});
|
||||
|
||||
it("fetch metadata", async () => {
|
||||
const meta = await token.getMetadata();
|
||||
expect(meta.name).to.eq("My Token");
|
||||
});
|
||||
|
||||
it("mint more should update total supply", async () => {
|
||||
expect((await token.totalSupply()).toString()).to.eq("100000000000");
|
||||
await token.mint(3);
|
||||
expect((await token.totalSupply()).toString()).to.eq("103000000000");
|
||||
});
|
||||
|
||||
it("transfer should update total supply", async () => {
|
||||
expect((await token.balance()).toString()).to.eq("103000000000");
|
||||
const receiver = Keypair.generate();
|
||||
await token.transfer(receiver.publicKey.toBase58(), 10);
|
||||
expect((await token.balance()).toString()).to.eq("93000000000");
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/storage
|
||||
|
||||
## 0.2.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#63](https://github.com/thirdweb-dev/js/pull/63) [`f2bdf47`](https://github.com/thirdweb-dev/js/commit/f2bdf47b4fd06433be367c9aac6d11a8dbbf1a1a) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Add storage option to include gateway url in uploaded metadata
|
||||
|
||||
## 0.2.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/storage",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"main": "dist/thirdweb-dev-storage.cjs.js",
|
||||
"module": "dist/thirdweb-dev-storage.esm.js",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/storage",
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from "../helpers/storage";
|
||||
import { IStorage } from "../interfaces/IStorage";
|
||||
import { IStorageUpload, UploadResult } from "../interfaces/IStorageUpload";
|
||||
import { FileOrBuffer, JsonObject } from "../types";
|
||||
import { FileOrBuffer, JsonObject, StorageOptions } from "../types";
|
||||
import { UploadProgressEvent } from "../types/events";
|
||||
import { PinataUploader } from "../uploaders/pinata-uploader";
|
||||
import fetch from "cross-fetch";
|
||||
@@ -32,13 +32,16 @@ export class IpfsStorage implements IStorage {
|
||||
public gatewayUrl: string;
|
||||
private failedUrls: string[] = [];
|
||||
private uploader: IStorageUpload;
|
||||
private options: StorageOptions | undefined;
|
||||
|
||||
constructor(
|
||||
gatewayUrl: string = DEFAULT_IPFS_GATEWAY,
|
||||
uploader: IStorageUpload = new PinataUploader(),
|
||||
options?: StorageOptions,
|
||||
) {
|
||||
this.gatewayUrl = `${gatewayUrl.replace(/\/$/, "")}/`;
|
||||
this.uploader = uploader;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
private getNextPublicGateway() {
|
||||
@@ -53,6 +56,14 @@ export class IpfsStorage implements IStorage {
|
||||
}
|
||||
}
|
||||
|
||||
private getBaseUri() {
|
||||
if (this.options?.appendGatewayUrl) {
|
||||
return this.gatewayUrl;
|
||||
} else {
|
||||
return "ipfs://";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a file to IPFS and return the hash
|
||||
* @remarks This method is a wrapper around {@link IStorage.upload}
|
||||
@@ -80,7 +91,7 @@ export class IpfsStorage implements IStorage {
|
||||
options,
|
||||
);
|
||||
|
||||
const baseUri = `ipfs://${cid}/`;
|
||||
const baseUri = `${this.getBaseUri()}${cid}/`;
|
||||
return `${baseUri}${fileNames[0]}`;
|
||||
}
|
||||
|
||||
@@ -104,7 +115,7 @@ export class IpfsStorage implements IStorage {
|
||||
options,
|
||||
);
|
||||
|
||||
const baseUri = `ipfs://${cid}/`;
|
||||
const baseUri = `${this.getBaseUri()}${cid}/`;
|
||||
const uris = fileNames.map((filename) => `${baseUri}${filename}`);
|
||||
return {
|
||||
baseUri,
|
||||
@@ -174,7 +185,7 @@ export class IpfsStorage implements IStorage {
|
||||
signerAddress,
|
||||
);
|
||||
|
||||
const baseUri = `ipfs://${cid}/`;
|
||||
const baseUri = `${this.getBaseUri()}${cid}/`;
|
||||
const uris = fileNames.map((filename) => `${baseUri}${filename}`);
|
||||
|
||||
return {
|
||||
@@ -230,7 +241,7 @@ export class IpfsStorage implements IStorage {
|
||||
// replace all active gateway url links with their raw ipfs hash
|
||||
const sanitizedMetadatas = replaceGatewayUrlWithHash(
|
||||
metadatas,
|
||||
"ipfs://",
|
||||
this.getBaseUri(),
|
||||
this.gatewayUrl,
|
||||
);
|
||||
// extract any binary file to upload
|
||||
@@ -257,7 +268,11 @@ export class IpfsStorage implements IStorage {
|
||||
}
|
||||
|
||||
// replace all files with their ipfs hash
|
||||
return replaceFilePropertiesWithHashes(sanitizedMetadatas, cids);
|
||||
return replaceFilePropertiesWithHashes(
|
||||
sanitizedMetadatas,
|
||||
cids,
|
||||
this.getBaseUri(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,13 +23,14 @@ export function isBufferInstance(data: any): data is Buffer {
|
||||
export function replaceFilePropertiesWithHashes(
|
||||
object: Record<string, any>,
|
||||
cids: string[],
|
||||
scheme: string,
|
||||
) {
|
||||
const keys = Object.keys(object);
|
||||
for (const key in keys) {
|
||||
const val = object[keys[key]];
|
||||
const isFile = isFileInstance(val) || isBufferInstance(val);
|
||||
if (typeof val === "object" && !isFile) {
|
||||
replaceFilePropertiesWithHashes(val, cids);
|
||||
replaceFilePropertiesWithHashes(val, cids, scheme);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -37,7 +38,7 @@ export function replaceFilePropertiesWithHashes(
|
||||
continue;
|
||||
}
|
||||
|
||||
object[keys[key]] = `ipfs://${cids.splice(0, 1)[0]}`;
|
||||
object[keys[key]] = `${scheme}${cids.splice(0, 1)[0]}`;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -2,5 +2,6 @@ export * from "./interfaces/IStorage";
|
||||
export * from "./interfaces/IStorageUpload";
|
||||
export * from "./core/ipfs-storage";
|
||||
export * from "./core/remote-storage";
|
||||
export * from "./uploaders/pinata-uploader";
|
||||
export * from "./types/index";
|
||||
export { isBufferInstance, isFileInstance } from "./helpers/storage";
|
||||
|
||||
@@ -26,3 +26,7 @@ const fileOrBufferUnion = isBrowser()
|
||||
|
||||
export const FileBufferOrStringSchema = z.union(fileOrBufferUnion);
|
||||
export type FileBufferOrString = z.output<typeof FileBufferOrStringSchema>;
|
||||
|
||||
export type StorageOptions = {
|
||||
appendGatewayUrl: boolean;
|
||||
};
|
||||
|
||||
@@ -3573,10 +3573,10 @@
|
||||
"@types/use-sync-external-store" "^0.0.3"
|
||||
use-sync-external-store "^1.2.0"
|
||||
|
||||
"@thirdweb-dev/[email protected]0":
|
||||
version "3.1.6-0"
|
||||
resolved "https://registry.yarnpkg.com/@thirdweb-dev/contracts/-/contracts-3.1.6-0.tgz#324879bb4bbf29587a099246f7706c920b4d4ef7"
|
||||
integrity sha512-LKhttHQXBclFVPD3ya4cQyde9XRqx4KnVpMA/Z9S4Fxlpi7QWMR8tUwcGg4utOJJeUBp3V5O3aYz4+jFLEzncw==
|
||||
"@thirdweb-dev/[email protected]1":
|
||||
version "3.1.6-1"
|
||||
resolved "https://registry.yarnpkg.com/@thirdweb-dev/contracts/-/contracts-3.1.6-1.tgz#81fc678c89b407bd577d4021500ff1a5de825179"
|
||||
integrity sha512-dNIqIsY2JYc+GVG9fZs3HfmgRY2pn6dYSmstGW4IcQmRpM4a3HYbz6FIgX4N9012xo0aNPbBWEq9pfQ3bdY86Q==
|
||||
|
||||
"@trivago/prettier-plugin-sort-imports@^3.3.0":
|
||||
version "3.3.0"
|
||||
|
||||
Reference in New Issue
Block a user