Compare commits

...
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
1b8accde30 Version Packages (#1782)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-16 15:51:35 -07:00
Joaquim VergesandGitHub 07544252b4 [SDK] expose utility functions for abi / sources (#1781) 2023-10-16 22:43:13 +00:00
20 changed files with 108 additions and 12 deletions
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/auth
## 4.0.6
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.0.6
## 4.0.5
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.0.5",
"version": "4.0.6",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+9
View File
@@ -1,5 +1,14 @@
# thirdweb
## 0.13.6
### Patch Changes
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
- @thirdweb-dev/sdk@4.0.5
- @thirdweb-dev/wallets@2.0.6
- @thirdweb-dev/auth@4.0.6
## 0.13.5
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.13.5",
"version": "0.13.6",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/react-core
## 4.0.6
### Patch Changes
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
- @thirdweb-dev/sdk@4.0.5
- @thirdweb-dev/wallets@2.0.6
- @thirdweb-dev/auth@4.0.6
## 4.0.5
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "4.0.5",
"version": "4.0.6",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,5 +1,7 @@
# @thirdweb-dev/react-native-compat
## 0.3.11
## 0.3.10
## 0.3.9
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.3.10",
"version": "0.3.11",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/react-native
## 0.3.11
### Patch Changes
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
- @thirdweb-dev/sdk@4.0.5
- @thirdweb-dev/react-core@4.0.6
- @thirdweb-dev/wallets@2.0.6
## 0.3.10
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.3.10",
"version": "0.3.11",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/react
## 4.0.6
### Patch Changes
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
- @thirdweb-dev/sdk@4.0.5
- @thirdweb-dev/react-core@4.0.6
- @thirdweb-dev/wallets@2.0.6
## 4.0.5
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "4.0.5",
"version": "4.0.6",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/sdk
## 4.0.5
### Patch Changes
- [#1781](https://github.com/thirdweb-dev/js/pull/1781) [`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Expose utility functions for fetching ABI / sources
## 4.0.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "4.0.4",
"version": "4.0.5",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
@@ -7,9 +7,11 @@ import {
AbiEvent,
AbiFunction,
AbiSchema,
ContractSource,
PublishedMetadata,
} from "../../schema/contracts/custom";
import { ContractWrapper } from "./contract-wrapper";
import { fetchSourceFilesFromMetadata } from "../../common";
/**
* Handles publish metadata for a contract
@@ -47,6 +49,14 @@ export class ContractPublishedMetadata<TContract extends BaseContract> {
return this._cachedMetadata;
}
/**
* @public
*/
public async extractSources(): Promise<ContractSource[]> {
const publishedMetadata = await this.get();
return fetchSourceFilesFromMetadata(publishedMetadata, this.storage);
}
/**
* @public
*/
@@ -27,6 +27,7 @@ import { buildTransactionFunction } from "../../common/transactions";
import { isIncrementalVersion } from "../../common/version-checker";
import { getContractPublisherAddress } from "../../constants/addresses/getContractPublisherAddress";
import {
Abi,
AbiFunction,
AbiSchema,
ContractParam,
@@ -41,6 +42,7 @@ import {
PublishedContract,
PublishedContractFetched,
PublishedContractSchema,
PublishedMetadata,
} from "../../schema/contracts/custom";
import { SDKOptions } from "../../schema/sdk-options";
import { AddressOrEns } from "../../schema/shared/AddressOrEnsSchema";
@@ -137,10 +139,11 @@ export class ContractPublisher extends RPCConnectionHandler {
}
/**
* @internal
* @param address
*/
public async fetchCompilerMetadataFromAddress(address: AddressOrEns) {
public async fetchCompilerMetadataFromAddress(
address: AddressOrEns,
): Promise<PublishedMetadata> {
const resolvedAddress = await resolveAddress(address);
return fetchContractMetadataFromAddress(
resolvedAddress,
@@ -217,7 +220,7 @@ export class ContractPublisher extends RPCConnectionHandler {
}
/**
* @internal
* Fetch all sources for a contract from its address
* @param address
*/
public async fetchContractSourcesFromAddress(
@@ -230,6 +233,22 @@ export class ContractPublisher extends RPCConnectionHandler {
return await fetchSourceFilesFromMetadata(metadata, this.storage);
}
/**
* Fetch ABI from a contract, or undefined if not found
* @param address
*/
public async fetchContractAbiFromAddress(
address: AddressOrEns,
): Promise<Abi | undefined> {
const resolvedAddress = await resolveAddress(address);
const meta = await fetchContractMetadataFromAddress(
resolvedAddress,
this.getProvider(),
this.storage,
);
return meta.abi;
}
/**
* @internal
* @param profileMetadata
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/unity-js-bridge
## 0.2.92
### Patch Changes
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
- @thirdweb-dev/sdk@4.0.5
- @thirdweb-dev/wallets@2.0.6
- @thirdweb-dev/auth@4.0.6
## 0.2.91
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.91",
"version": "0.2.92",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/wallets
## 2.0.6
### Patch Changes
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
- @thirdweb-dev/sdk@4.0.5
## 2.0.5
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "2.0.5",
"version": "2.0.6",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",