Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer reserved names to owners #18

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/suins-build-tx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
description: 'select transaction type to create'
type: choice
options:
- Transfer Reserved Names
- Main package upgrade
- Disable BOGO App
- Publish Registration Package
Expand Down Expand Up @@ -124,6 +125,16 @@ jobs:
run: |
cd scripts && pnpm migrations::registration::transition

- name: Transfer Reserved Names
if: ${{ inputs.transaction_type == 'Transfer Reserved Names' }}
env:
NODE_ENV: production
GAS_OBJECT: ${{ inputs.gas_object_id }}
NETWORK: mainnet
ORIGIN: gh_action
run: |
cd scripts && pnpm transfer::names

- name: Show Transaction Data (To sign)
run: |
cat scripts/tx/tx-data.txt
Expand Down
3 changes: 2 additions & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"transactions::main_package::upgrade": "ts-node transactions/main_package_upgrade.ts",
"migrations::day_one::deauthorize": "ts-node transactions/deauthorize_bogo_app.ts",
"transactions::registration::publish": "ts-node transactions/publish_registration.ts",
"migrations::registration::transition": "ts-node transactions/deauthorize_auction_authorize_registration.ts"
"migrations::registration::transition": "ts-node transactions/deauthorize_auction_authorize_registration.ts",
"transfer::names": "ts-node reserved-names/transfer-names.ts"
},
"keywords": [],
"author": "",
Expand Down
96 changes: 96 additions & 0 deletions scripts/reserved-names/data/transfers.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Employee Name,Wallet Address,Reserved .sui Name,Date Entered,Date Sent
Vyz,0x68aec368ab71e547ac1441cff76406b15239076a70916badb7455e3cfffacc66,vyz,8/7/2023,
metabolic,0x4b802c6e1a4d8d89e53dc1889d321da178cab516e6e768624f7b150d7564a48f,metabolic,8/7/2023,
henkayy,0x47077543f106baae87f6a016748ed47402c4f16a2dc7fc0e5acbb17c20b3ca9e,Henkayy,8/7/2023,
taybew,0x5ae974c80c4e44e3c4f05514c4a0068ab5e6a0462f1510fa547b43b74309bbb7,tay,8/7/2023,
aaandrew,0x61d9d101f1bf9f508af89bace5041a117ea3ab4287157bd37dfa3160011e8f1b,Aandrew,8/7/2023,
jack,0x9a697341483445267d887844df83eee6c98213f3a1fd50c11669761a37063509,jack,8/7/2023,
gsandly,0xdcae748409eb9e23353fc43a1c5d7f39f784d9ba594ea267091d8f95554809b0,gsandly,8/7/2023,
wolfer,0xd43eb325e81d21b17f6e06809ff09612e40d77f29dbb0d6533c03f6ec2c420d3,wolfer,8/7/2023,
nikita,0x51aed3b31497c50c6eac67cac9269e05fd1e19ac92c280b8cfdfe3152e7fab26,nikita,8/7/2023,
Danny,0x493b3deed449b1c8514ba9e5b929b1426cd3835a660564c74d676a7f1cd05234,danny,8/7/2023,
Sean,0x7d7806958604640188e11dd15bd9626284e6d8264e22a02b13cf2c461515d7ea,sean,8/7/2023,

Jordan Gensler,0x5a3afb4e2d6421488d4417f8cbdaf276079dd6f9c0195d8c8453c7a56d863194,jordan,7/24/2023,
Jk Jensen,0x67811b3539938bdbc3915c451436c56add5f956dc88e7c226e7e184fe60a39dc,jkj,7/24/2023,
Fred Allan Bailey,0x5e830b6faf0a67d216a943d5da0150c2a45c81e85cda018fdc966a04c2f7039d,zirpu,7/24/2023,
Sai Krishna Deepak Maram,0xaf526996bfba68af95bdf5f1aa7bc01f8154502f0a10043fd8a4838ab8f126bf,deepak,7/24/2023,
Han Liu,0x7ab79329ec87b214473ffa92f72992670d073d7bab44506b9c54263418bc8f2c,han,7/24/2023,
Brandon Williams,0x2a5f20e20d1f805bbc7feb0c4b49747003e3f47e3b51d67690f3c31152d877aa,brandon,7/24/2023,
Abhishek Kumar,0x03d054f153ff7d54f1c240fc3006258ae19e0fe572fa80496a068703c7d7cb7f,abhi,7/24/2023,
Xun Li,0xec4f4dd96f0b3eb8456c496aa4dde1e2b8310a09d126f62d51b88ba419f85c2c,xun,7/24/2023,
Mark Logan,0x13506993736c126f46e780b7a658f615c308dea2f9c9f1eba430453ccb170d1e,marklogan,7/24/2023,
Barry Chang,0x03e61430989e73be288e74bb58908ad44543ae578761c813a23be9010a72f70e,barry,7/24/2023,
Phong Lam,0xe3e7505952d4ecb7da4c00dd6bf88e45b2a06bf8fbbb034177b00b378914fd8c,phong,7/24/2023,
Ronny Roland,0x98bd90a13940cb3f6269dd7b2dcc787240fe9edebfe33fa35d736b5a0fcf2181,ron,7/24/2023,
Anthony Palma,0xe814f833a4091ebb669734886532b1eebf835a5be4b81d5480e7ce8dfe54b2f3,anthony,7/24/2023,
Anthony Palma,0xe814f833a4091ebb669734886532b1eebf835a5be4b81d5480e7ce8dfe54b2f3,AnthonyRPalma,7/24/2023,
Anthony Palma,0xe814f833a4091ebb669734886532b1eebf835a5be4b81d5480e7ce8dfe54b2f3,Stembo,7/24/2023,
Anthony Palma,0xe814f833a4091ebb669734886532b1eebf835a5be4b81d5480e7ce8dfe54b2f3,apalma,7/24/2023,
Marco Petriella,0xe12862497c932868ee6b3fe04a6ec2f3d7229d9c52dcd3a540df334e2313b3d0,marco,7/24/2023,
Patrick O'Rourke,0x7de8f971b3f9751a6560d8c49a677eb0ffc4ac6a8904b9bbbf5c923a150eec85,pjourke,7/24/2023,
William Smith,0xf749f4d5af3b888e6c5755c1abc6f752e2a42cbcb3e820c793ed82092b126d48,will,7/24/2023,
William Yang,0x5217ca01919fdd6bb8cd3a384733172c30b37b2435c844cbe5de834f635c6672,yang,7/24/2023,
Alberto Sonnino,0xe8fc90ceef700d310172e5e121c603863dc54e9113162ecfdcb4847af7978a4a,alberto,7/24/2023,
Joe Hrbek,0xce86462815bba77ad22eec1b69f68f4bcefc7219168cf4ccf67daa416400ab44,joe,7/24/2023,
Andrew St.Germain,0xcdc4c00fe020f93b584c5404f9621b1f6e180a81ed02fb7b78b4ff7416236819,asg,7/24/2023,
alonso de gortari,0x79ecc6f239fd5fdd2a3b51dcbd9c449b52e7892ef2d6f59c82b582813d7fb69e,alonso,7/24/2023,
Ed Snook,0x5e85ee3645a5ae562e8be16da05fb2a01e94f81f476277d8176c87310f9a9bc2,edo,7/24/2023,
Evan Cheng,0x11086a8f83c5b11c101509662474f02549aee68a3d91d60970d91c1b480d5dae,Evan,7/24/2023,
Evan Cheng,0x11086a8f83c5b11c101509662474f02549aee68a3d91d60970d91c1b480d5dae,EvanCheng,7/24/2023,
Evan Cheng,0x11086a8f83c5b11c101509662474f02549aee68a3d91d60970d91c1b480d5dae,EvanWeb3,7/24/2023,
Evan Cheng,0x11086a8f83c5b11c101509662474f02549aee68a3d91d60970d91c1b480d5dae,ChasingPtr,7/24/2023,
Adam Welc,0x131cb35854151c884804aceda8a4ce4b205cb38709270d00d8cff0d3627e59cd,adam,7/24/2023,
Maria Siopi,0xb2afed36e54cb558267433a25e5c21d121065026aece85e8df742bd84e2c3a7d,maria,7/24/2023,
Theodore,0x9c28d8a5853c9a52cc4863331f6fa9931732a5e548d6027aafa9fcc7387929f3,teo,7/24/2023,
Stefanos Pleros,0x9a13bca12a4360885185e53f0c20bd47c7707e895cbddeed96d6daa293ca084d,stefanos,7/24/2023,
Markus Legner,0x3243f6a9b420e8f887bc45286cf3fc013b6bec26829b350daa9cf96972609a47,markus,7/24/2023,
Karl Wüst,0x42ccc0e741ce122183347a8d8dd51112e7135ed24f6e4b193d584ce5a53d02eb,karl,7/24/2023,
Ashok Ajith Kumar Menon,0x1e80a4f8cd8517098ca589d306127f16ed852d7d69d905d65c7463f3bb945d02,amnn,7/24/2023,
Anoop Kansupada,0x2d3409b5b4726e77699ca926af43c1509ef4087ccd0ae19d30eafaf04e08509b,anoop,7/24/2023,
Anoop Kansupada,0x2d3409b5b4726e77699ca926af43c1509ef4087ccd0ae19d30eafaf04e08509b,snoopventures,7/24/2023,
Anoop Kansupada,0x2d3409b5b4726e77699ca926af43c1509ef4087ccd0ae19d30eafaf04e08509b,anoopk,7/24/2023,
Anoop Kansupada,0x2d3409b5b4726e77699ca926af43c1509ef4087ccd0ae19d30eafaf04e08509b,Anoopkansupada,7/24/2023,
Arnab Roy,0x7a512fb635ea32d52fdd3c2f8f264ca388f196326b4f92299365492485b72c73,arnab,7/24/2023,
Jennifer Kye,0xf0e94eb7e7a5180f081cc3c78fc9648103ded357b9dd63e03282f95964dc8b1d,jen,7/24/2023,
Adrian Perrig,0x48ec8d0a673128806dcc404fc99891195fa78dce50d66df8a0b49ae14765d30d,adrian,7/24/2023,
Alexandros Aias Tsiliris,0xdbd21f148f769f9875637135c7f61bd749809dcf14933434ad0a301dae332c15,alex,7/24/2023,
Robert Fullen,0x66c977a9d6bf4a24f06acd4b151c52ad2e99ade901063ee0539390f2d52f42e2,rob,7/24/2023,
John Martin,0xd55e6b9d78bf6722d60085fb2df831bfb167732a0c4390796386b9d5259893db,john,7/24/2023,
Eleftherios Kokoris Kogias,0xd14b8885b83f5cc288b9c60d7b1aaf77a47ba6afe204fa259e237cc5b58b92d5,lefteris,7/24/2023,
Bill Allred,0x3ae4592005115a2dd4eeada0179c9e64368f0056dbbe0afeb15415e0ae8defb0,bill,8/7/2023,
Kiefer Hickman,0xc8e166cfa7ebec86d8f11c0f3153a2179150467914294b1f7518f6141ddd3c0f,kiefer,7/14/2023,
Sam Blackshear,0x312480b61405caf32a0c98e8f734d2174e0d196e1073f1b399d84956c55990c2,sam,7/14/2023,
Sam Blackshear,0x312480b61405caf32a0c98e8f734d2174e0d196e1073f1b399d84956c55990c2,b1ackd0g,7/14/2023,
Adeniyi Abiodun,0x1eb7c57e3f2bd0fc6cb9dcffd143ea957e4d98f805c358733f76dee0667fe0b1,Ade,8/28/2023,
Adeniyi Abiodun,0x1eb7c57e3f2bd0fc6cb9dcffd143ea957e4d98f805c358733f76dee0667fe0b1,YieldFa,8/28/2023,
Adeniyi Abiodun,0x1eb7c57e3f2bd0fc6cb9dcffd143ea957e4d98f805c358733f76dee0667fe0b1,EmanAbio,8/28/2023,
George Danezis,0xe89b9c54766062410c724c25c493b67b4486d62cd978f860e2f7ea9146081457,George,8/28/2023,
George Danezis,0xe89b9c54766062410c724c25c493b67b4486d62cd978f860e2f7ea9146081457,Gdanezis,8/28/2023,

Nikhil Chari,0x1d632d46ff70491033fefc4e6398dceaa4943dcf62512b4d57378b5ab703bc5e,shinami,,
Jack Xiao,0x26511d10debeaeb8d177a22278a3ac5a95e68056bb58028d8a4a535ceb7a08c2,suia,,
Wan Jian Hau,0xb84bc37cd42381a71169826993b345b4c3f8b5b9da1ffeaf940edf48fcc9d3af,suipad,,
Meta Chan,0xd1ec28b6c0efe674eae2b749a2635a0d63a9a14640df8ebfd70af4222461285c,blockvision,,
Meta Chan,0x9ae909412385457a111a4a081f5c40fc41add7c0098fc99f18b54b1d7a33c387,suivision,,
Cetus,0x4fb3842cf929346686217f0bdba786925e08947f65bc884ffa0d29f5e5daa800,Cetus,,
Jack Smith,0x228e4821a94be23eaca6a62007163d7818c46a941c460aa61012256db2a845e6,bluemove,,
Kevin Aftermath,0x4b02b9b45f2a9597363fbaacb2fd6e7fb8ed9329bb6f716631b5717048908ace,aftermath,,
Nadia Eldeib,0x80e72f42e25e484ecb97a0dc1922d132e29f88fbf44f68d131f5277e1f2495d4,ethos,,
Nadia Eldeib,0x80e72f42e25e484ecb97a0dc1922d132e29f88fbf44f68d131f5277e1f2495d4,ethoswallet,,
Okan Dilen,0x8e90c5c8e3092569c96cdba1238f1c39ec85db615dd8e233e5033a851c0d087c,suigallery,,
Okan Dilen,0x8e90c5c8e3092569c96cdba1238f1c39ec85db615dd8e233e5033a851c0d087c,gallery,,
Okan Dilen,0x8e90c5c8e3092569c96cdba1238f1c39ec85db615dd8e233e5033a851c0d087c,gallerysui,,
Christian Cuffari,0x9876657fbc5f7083bc127f404e0f4a296e110bcc966325ff1c099521ab6fd97f,osec,,
alex yeung,0x13e7d893ffb8ea3db2b1aa1954132f1f879f2917c8e0f592ddbcbe9089a0a6f6,surf,,
Norman Kwok,0xa987c410fa047b973d479555894c85208c4450ef65fd1d8d5911b46fbca83365,spartanlabs,,
Raymond Laracuenta,0xfd98168b77c305148967cdcafdfbd03da664ccb50aae335b72e226feba3e6933,gilder,,
Kris Lai,0x5e813e4c2504b76bfbef802411c11d1688b5d35f7a5c209e9eb4eb78780b322a,Scallop,,
Lucky Kat Studios,0x79b1ee1d662accd46280dd1bb0aa817bfb7762d8908e5ba6165c4f829575a72f,cosmocadia,,
Lucky Kat Studios,0x79b1ee1d662accd46280dd1bb0aa817bfb7762d8908e5ba6165c4f829575a72f,panzerdogs,,
Lucky Kat Studios,0x79b1ee1d662accd46280dd1bb0aa817bfb7762d8908e5ba6165c4f829575a72f,lucky-kat,,
anthony,0x015ef4a7d4800fd1c8e557add32880ff6e945fa5beaf00cd6540deb03c337b41,stork,,
LOUTALAKIO RAPHAEL ,0xf5d1038b1a3c9da0865a99ac70ca97b6cd37034c20c280a81aa5b22e83bcc6ec,Hominids,,
Craig Holiday,0xa07c66ff9a89b5b78317d0675063b27109d25bea7fe298e0f433343c4cb3a32c,SpaceAndTime,,
Tim Kravchunovsky,0xb0cf53be09fc9dfe5d5f932db69a217759ff57985cddfe420efb56018d4bfbc5,Chirp,,
Tim Kravchunovsky,0xb0cf53be09fc9dfe5d5f932db69a217759ff57985cddfe420efb56018d4bfbc5,Chirpwireless,,
41 changes: 41 additions & 0 deletions scripts/reserved-names/objects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { mainPackage } from "../config/constants";
import fs from "fs";

const config = mainPackage.mainnet;

const getAllOwnedDomains = async () => {

let hasNextPage = true;
let cursor = undefined;

let names = [];

while(hasNextPage){
const res = await config.provider.getOwnedObjects({
owner: config.adminAddress,
filter: {
MatchAll: [
{
StructType: `0xd22b24490e0bae52676651b4f56660a5ff8022a2576e0089f79b3c88d44e08f0::suins_registration::SuinsRegistration`
},
],
},
options: {
showContent: true,
showType: true,
},
cursor
});
names.push(...res.data);
hasNextPage = res.hasNextPage;

cursor = res.nextCursor;

console.log("Total names after batch: " + names.length);
}

// Save to file.
fs.writeFileSync('./owned-objects.json', JSON.stringify(names));
}

getAllOwnedDomains();
1 change: 1 addition & 0 deletions scripts/reserved-names/owned-objects.json

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions scripts/reserved-names/transfer-names.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { SuiObjectResponse, TransactionBlock, isValidSuiAddress } from "@mysten/sui.js";
import fs from "fs";
import { prepareMultisigTx } from "../airdrop/helper";

// A {name: address} map
const domains: Record<string, string> = {};
// A {recipient, uniqueObjectIds} map
const recipients: Record<string, Set<string>> = {};

type TransferObject = {
name: string;
address: string;
domain: string;
domainObjectId?: string;
}

type DomainData = {
objectId: string;
name: string;
}

// Reads the owned objects + formats them in a `name: objectId` format.
const parseOwnedObjects = () => {
const ownedObjects = JSON.parse(fs.readFileSync('./reserved-names/owned-objects.json').toString()) as SuiObjectResponse[];

const names: DomainData[] = ownedObjects.map(({ data }) => ({
objectId: data?.objectId || '',
//@ts-ignore-next-line
name: data?.content!.fields!.domain_name || ''
}));

// Map the names as `name: address`.
for(let name of names) {
domains[name.name] = name.objectId
}
}

// Parses the combined CSV
const parseCsvFile = () => {

fs.readFileSync('./reserved-names/data/transfers.csv')
.toString()
.split('\n')
.map(x => x.split(','))
.filter(x => !!x && !!x[0])
.map( ([name, address, domain]) => ({
name,
address,
domain: domain.toLowerCase()
} as TransferObject))
.filter(x => {
const isValid = isValidSuiAddress(x.address)
if(!isValid) console.info(`Invalid address: ${x.address} | ${x.name} | ${x.domain}`)
return isValid
})
.map(x => {
x.domain = x.domain.endsWith('.sui') ? x.domain : `${x.domain}.sui`
return x
})
.map(x => {
if(!domains[x.domain]) console.info(`Couldn't find objectId for name ${x.domain}`);
x.domainObjectId = domains[x.domain];
return x;
// lets find the objectId for that domain.
}).forEach(recipient => {
if(!recipients[recipient.address]) recipients[recipient.address] = new Set();
recipients[recipient.address].add(recipient.domainObjectId!)
});

// recipients -> address -> [] objects it receives
// console.log(recipients);
}

const prepareTx = () => {

const txb = new TransactionBlock();

for(let recipient of Object.keys(recipients)) {
txb.transferObjects([...recipients[recipient]].filter(x => !!x).map(x => txb.object(x)), txb.pure(recipient, 'address'));
}
return prepareMultisigTx(txb, 'mainnet');
}

// parses all owned OBjects from `json` file.
// If you want to refresh the owned data for the SuiNS admin, re-run `ts-node objects.ts`.
parseOwnedObjects();
// Parses the `transfers.csv` file, and creates the list of object transfers
parseCsvFile();

// Prepares the TXB for that and saves it in tx-data.
prepareTx();