Skip to content

Commit

Permalink
v0.13.0 add default config
Browse files Browse the repository at this point in the history
  • Loading branch information
jaensen committed Oct 14, 2024
1 parent 796559c commit 0f6323e
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 40 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
},
"name": "@cirlces-sdk/root",
"license": "MIT",
"version": "0.12.2"
"version": "0.13.0"
}
2 changes: 1 addition & 1 deletion packages/abi-v1/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/abi-v1",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/abi-v2",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-cometh/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/adapter-cometh",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/adapter": "0.12.2",
"@circles-sdk/adapter": "0.13.0",
"@cometh/connect-sdk": "1.2.29"
},
"keywords": [],
Expand Down
5 changes: 3 additions & 2 deletions packages/adapter-ethers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/adapter-ethers",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -18,7 +18,8 @@
},
"dependencies": {
"ethers": "^6.13.2",
"@circles-sdk/adapter": "0.12.2"
"@circles-sdk/adapter": "0.13.0",
"@circles-sdk/utils": "0.13.0"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-ethers/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export default {
tsconfig: './tsconfig.json'
})
],
external: ["ethers"]
external: ["ethers", '@circles-sdk/utils']
};
4 changes: 2 additions & 2 deletions packages/adapter-safe-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/adapter-safe-app",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/adapter": "0.12.2",
"@circles-sdk/adapter": "0.13.0",
"@safe-global/safe-apps-sdk": "^9.1.0"
},
"keywords": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-safe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/adapter-safe",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/adapter",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/data",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/utils": "0.12.2"
"@circles-sdk/utils": "0.13.0"
},
"keywords": [],
"author": "",
Expand Down
4 changes: 2 additions & 2 deletions packages/profiles/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/profiles",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/utils": "0.12.2"
"@circles-sdk/utils": "0.13.0"
},
"keywords": [],
"author": "",
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/sdk",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,11 +17,11 @@
"author": "",
"license": "MIT",
"dependencies": {
"@circles-sdk/abi-v1": "0.12.2",
"@circles-sdk/abi-v2": "0.12.2",
"@circles-sdk/data": "0.12.2",
"@circles-sdk/profiles": "0.12.2",
"@circles-sdk/adapter-ethers": "0.12.2",
"@circles-sdk/abi-v1": "0.13.0",
"@circles-sdk/abi-v2": "0.13.0",
"@circles-sdk/data": "0.13.0",
"@circles-sdk/profiles": "0.13.0",
"@circles-sdk/adapter-ethers": "0.13.0",
"ethers": "^6.13.2",
"multihashes": "^4.0.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/circlesConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export interface CirclesConfig {
readonly nameRegistryAddress?: string;
readonly migrationAddress?: string;
readonly baseGroupMintPolicy?: string;
readonly standardTreasuryPolicy?: string;
readonly standardTreasury?: string;
}
16 changes: 16 additions & 0 deletions packages/sdk/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {CirclesConfig} from "./circlesConfig";

export const circlesConfig: { [chainId: number]: CirclesConfig } = {
100: {
circlesRpcUrl: "https://rpc.aboutcircles.com/",
pathfinderUrl: "https://pathfinder.aboutcircles.com",
profileServiceUrl: "https://rpc.aboutcircles.com/profiles/",
v2PathfinderUrl: "https://rpc.aboutcircles.com/pathfinder/",
v1HubAddress: "0x29b9a7fbb8995b2423a71cc17cf9810798f6c543",
v2HubAddress: "0xc12C1E50ABB450d6205Ea2C3Fa861b3B834d13e8",
nameRegistryAddress: "0xA27566fD89162cC3D40Cb59c87AAaA49B85F3474",
migrationAddress: "0xD44B8dcFBaDfC78EA64c55B705BFc68199B56376",
baseGroupMintPolicy: "0xcCa27c26CF7BAC2a9928f42201d48220F0e3a549",
standardTreasury: "0x08F90aB73A515308f03A718257ff9887ED330C6e"
}
}
3 changes: 2 additions & 1 deletion packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export { V1Avatar } from './v1/v1Avatar';
export { CirclesConfig } from './circlesConfig';
export { AvatarRow, TrustListRow, TrustRelationRow } from '@circles-sdk/data';
export { AvatarInterface, AvatarInterfaceV2 } from './AvatarInterface';
export { Pathfinder, TransferPath, TransferStep } from './v1/pathfinder';
export { Pathfinder, TransferPath, TransferStep } from './v1/pathfinder';
export { circlesConfig } from './config';
32 changes: 17 additions & 15 deletions packages/sdk/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {cidV0ToUint8Array} from '@circles-sdk/utils';
import {GroupProfile, Profile, Profiles} from '@circles-sdk/profiles';
import {ContractRunner, ZeroAddress} from "ethers";
import {SdkContractRunner, TransactionRequest} from "@circles-sdk/adapter";
import {circlesConfig} from "./config";

/**
* The SDK interface.
Expand Down Expand Up @@ -142,33 +143,34 @@ export class Sdk implements SdkInterface {

/**
* Creates a new SDK instance.
* @param circlesConfig The chain specific Circles configuration.
* @param contractRunner A contract runner instance and its address.
* @param config The optional chain specific Circles configuration.
*/
constructor(circlesConfig: CirclesConfig, contractRunner: SdkContractRunner) {
this.circlesConfig = circlesConfig;
constructor(contractRunner: SdkContractRunner, config?: CirclesConfig) {
this.circlesConfig = config ?? circlesConfig[100];

this.contractRunner = contractRunner;
if (!this.contractRunner.address) {
throw new Error('Contract runner is not initialized');
}

this.circlesRpc = new CirclesRpc(circlesConfig.circlesRpcUrl);
this.circlesRpc = new CirclesRpc(this.circlesConfig.circlesRpcUrl);
this.data = new CirclesData(this.circlesRpc);
this.v1Hub = HubV1Factory.connect(circlesConfig.v1HubAddress ?? '0x29b9a7fBb8995b2423a71cC17cf9810798F6C543', <ContractRunner>this.contractRunner);
if (circlesConfig.v2HubAddress) {
this.v2Hub = HubV2Factory.connect(circlesConfig.v2HubAddress, <ContractRunner>this.contractRunner);
this.v1Hub = HubV1Factory.connect(this.circlesConfig.v1HubAddress ?? '0x29b9a7fBb8995b2423a71cC17cf9810798F6C543', <ContractRunner>this.contractRunner);
if (this.circlesConfig.v2HubAddress) {
this.v2Hub = HubV2Factory.connect(this.circlesConfig.v2HubAddress, <ContractRunner>this.contractRunner);
}
if (circlesConfig.pathfinderUrl) {
this.v1Pathfinder = new Pathfinder(circlesConfig.pathfinderUrl);
if (this.circlesConfig.pathfinderUrl) {
this.v1Pathfinder = new Pathfinder(this.circlesConfig.pathfinderUrl);
}
if (circlesConfig.v2PathfinderUrl) {
this.v2Pathfinder = new Pathfinder(circlesConfig.v2PathfinderUrl);
if (this.circlesConfig.v2PathfinderUrl) {
this.v2Pathfinder = new Pathfinder(this.circlesConfig.v2PathfinderUrl);
}
if (circlesConfig.nameRegistryAddress) {
this.nameRegistry = NameRegistry__factory.connect(circlesConfig.nameRegistryAddress, <ContractRunner>this.contractRunner);
if (this.circlesConfig.nameRegistryAddress) {
this.nameRegistry = NameRegistry__factory.connect(this.circlesConfig.nameRegistryAddress, <ContractRunner>this.contractRunner);
}
if (circlesConfig.profileServiceUrl) {
this.profiles = new Profiles(circlesConfig.profileServiceUrl);
if (this.circlesConfig.profileServiceUrl) {
this.profiles = new Profiles(this.circlesConfig.profileServiceUrl);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circles-sdk/utils",
"version": "0.12.2",
"version": "0.13.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand Down

0 comments on commit 0f6323e

Please sign in to comment.