Skip to content

Commit

Permalink
add the 'inviter' parameter to the migrateAvatar function to allow mi…
Browse files Browse the repository at this point in the history
…grations after the migration period
  • Loading branch information
jaensen committed Nov 27, 2024
1 parent 4dc1d85 commit c77a2fe
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 31 deletions.
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.14.0"
"version": "0.15.0-preview1"
}
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.14.0",
"version": "0.15.0-preview1",
"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.14.0",
"version": "0.15.0-preview1",
"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.14.0",
"version": "0.15.0-preview1",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/adapter": "0.14.0",
"@circles-sdk/adapter": "0.15.0-preview1",
"@cometh/connect-sdk": "1.2.29"
},
"keywords": [],
Expand Down
6 changes: 3 additions & 3 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.14.0",
"version": "0.15.0-preview1",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -18,8 +18,8 @@
},
"dependencies": {
"ethers": "^6.13.2",
"@circles-sdk/adapter": "0.14.0",
"@circles-sdk/utils": "0.14.0"
"@circles-sdk/adapter": "0.15.0-preview1",
"@circles-sdk/utils": "0.15.0-preview1"
},
"keywords": [],
"author": "",
Expand Down
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.14.0",
"version": "0.15.0-preview1",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/adapter": "0.14.0",
"@circles-sdk/adapter": "0.15.0-preview1",
"@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.14.0",
"version": "0.15.0-preview1",
"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.14.0",
"version": "0.15.0-preview1",
"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.14.0",
"version": "0.15.0-preview1",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/utils": "0.14.0"
"@circles-sdk/utils": "0.15.0-preview1"
},
"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.14.0",
"version": "0.15.0-preview1",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,7 +17,7 @@
"build": "rollup -c"
},
"dependencies": {
"@circles-sdk/utils": "0.14.0"
"@circles-sdk/utils": "0.15.0-preview1"
},
"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.14.0",
"version": "0.15.0-preview1",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand All @@ -17,11 +17,11 @@
"author": "",
"license": "MIT",
"dependencies": {
"@circles-sdk/abi-v1": "0.14.0",
"@circles-sdk/abi-v2": "0.14.0",
"@circles-sdk/data": "0.14.0",
"@circles-sdk/profiles": "0.14.0",
"@circles-sdk/adapter-ethers": "0.14.0",
"@circles-sdk/abi-v1": "0.15.0-preview1",
"@circles-sdk/abi-v2": "0.15.0-preview1",
"@circles-sdk/data": "0.15.0-preview1",
"@circles-sdk/profiles": "0.15.0-preview1",
"@circles-sdk/adapter-ethers": "0.15.0-preview1",
"ethers": "^6.13.2",
"multihashes": "^4.0.3"
},
Expand Down
17 changes: 9 additions & 8 deletions packages/sdk/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ interface SdkInterface {
/**
* Migrates a v1 avatar and all its Circles holdings to v2.
* [[ Currently only works for human avatars. ]]
* @param inviter The address of the avatar that invited the user to v2. Can be 'ZeroAddress' during migration period.
* @param avatar The avatar's address.
* @param profile The profile data of the avatar.
* @trustRelations An optional list of trust relations to migrate.
*/
migrateAvatar: (avatar: string, profile: Profile, trustRelations?: string[]) => Promise<void>;
migrateAvatar: (inviter: string, avatar: string, profile: Profile, trustRelations?: string[]) => Promise<void>;

/**
* Creates or updates a user profile.
Expand Down Expand Up @@ -359,16 +360,16 @@ export class Sdk implements SdkInterface {

/**
* Migrates a v1 avatar and all its Circles holdings to v2.
* @param avatar The avatar's address.
* @param profile The profile data of the avatar.
*/
/**
* Migrates a v1 avatar and all its Circles holdings to v2.
* @param inviter The address of the avatar that invited the user to v2. Can be 'ZeroAddress' during migration period.
* @param avatar The avatar's address.
* @param profile The profile data of the avatar.
* @param trustRelations An optional list of trust relations to migrate.
*/
migrateAvatar = async (avatar: string, profile: Profile, trustRelations?: string[]): Promise<void> => {
migrateAvatar = async (
inviter: string,
avatar: string,
profile: Profile,
trustRelations?: string[]): Promise<void> => {
if (!this.v2Hub) {
throw new Error('V2 hub not available');
}
Expand Down Expand Up @@ -423,7 +424,7 @@ export class Sdk implements SdkInterface {
const metadataDigest = await this.createProfileIfNecessary(profile);

if (avatarInfo.type === "CrcV1_Signup") {
const registerHumanData = this.v2Hub.interface.encodeFunctionData('registerHuman', [ZeroAddress, metadataDigest]);
const registerHumanData = this.v2Hub.interface.encodeFunctionData('registerHuman', [inviter, metadataDigest]);
const registerHumanTx: TransactionRequest = {
to: this.circlesConfig.v2HubAddress!,
data: registerHumanData,
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.14.0",
"version": "0.15.0-preview1",
"description": "",
"type": "module",
"main": "./dist/index.js",
Expand Down

0 comments on commit c77a2fe

Please sign in to comment.