Skip to content

Commit

Permalink
Merge pull request #4 from NillionNetwork/user_id_party_id
Browse files Browse the repository at this point in the history
Update scaffold-nillion to use 0.1.1 version of JS Client
  • Loading branch information
oceans404 authored Apr 3, 2024
2 parents 2292cc7 + cb92dd6 commit ed9363d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/app/nillion-compute/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const Home: NextPage = () => {
return libraries.nillionClient;
};
getNillionClientLibrary().then(nillionClient => {
const user_id = nillionClient.user_id();
const user_id = nillionClient.user_id;
setUserId(user_id);
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/app/nillion-hello-world-complete/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Home: NextPage = () => {
// call getNillionClientLibrary, then use the returned nillionClient
getNillionClientLibrary().then(nillionClient => {
// get the user_id from the instance of nillionClient
const user_id = nillionClient.user_id();
const user_id = nillionClient.user_id;
// update state: set user_id
setUserId(user_id);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@ethersproject/providers": "^5.7.2",
"@heroicons/react": "^2.0.11",
"@nillion/nillion-client-js-browser": "^0.0.9",
"@nillion/nillion-client-js-browser": "^0.1.1",
"@rainbow-me/rainbowkit": "1.3.5",
"@uniswap/sdk-core": "^4.0.1",
"@uniswap/v2-sdk": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/utils/nillion/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function compute(

// add input and output party details (name and party id) to program bindings
const partyName = "Party1";
const party_id = await nillionClient.party_id();
const party_id = nillionClient.party_id;
program_bindings.add_input_party(partyName, party_id);
program_bindings.add_output_party(partyName, party_id);

Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/utils/nillion/storeProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function storeProgram(nillionClient: any, programName: string): Pro
console.log("Stored program - action_id", action_id);

// return the program id
const userId = nillionClient.user_id();
const userId = nillionClient.user_id;
const program_id = `${userId}/${programName}`;
return program_id;
} catch (error: any) {
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/utils/nillion/storeSecretsBlob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function storeSecretsBlob(
const empty_blob_bindings = null;

// get user id for user storing the secret
const user_id = await nillionClient.user_id();
const user_id = nillionClient.user_id;

// create a permissions object, give the storer default perissions
const permissions = nillion.Permissions.default_for_user(user_id);
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/utils/nillion/storeSecretsInteger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export async function storeSecretsInteger(
const secret_program_bindings = new nillion.ProgramBindings(program_id);

// set the input party to the bindings to specify which party will provide the secret
const party_id = await nillionClient.party_id();
const party_id = nillionClient.party_id;
secret_program_bindings.add_input_party(party_name, party_id);
console.log("bindings, party_name:", party_name, "party_id", party_id);

// get user id for user storing the secret
const user_id = await nillionClient.user_id();
const user_id = nillionClient.user_id;

// create a permissions object, give the storer default permissions, including compute permissions with the program id
const permissions = nillion.Permissions.default_for_user(user_id, program_id);
Expand Down
2 changes: 1 addition & 1 deletion packages/nillion/bootstrap-local-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ done
OUTFILE=$(mktemp);
PIDFILE=$(mktemp);

"$NILLION_DEVNET" >"$OUTFILE" & echo $! >"$PIDFILE";
"$NILLION_DEVNET" --seed scaffold-nillion >"$OUTFILE" & echo $! >"$PIDFILE";
ENV_TO_UPDATE=".env ../nextjs/.env"
echo "--------------------"
echo "Updating your ${ENV_TO_UPDATE} files with nillion-devnet environment info... This may take a minute."
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1155,10 +1155,10 @@ __metadata:
languageName: node
linkType: hard

"@nillion/nillion-client-js-browser@npm:^0.0.9":
version: 0.0.9
resolution: "@nillion/nillion-client-js-browser@npm:0.0.9"
checksum: 445feeb669823be209cd16892f0af41bcedee5789953d8fb29d8fa69701c1ea542b021537d9b4a4bc63f27d246390e872d63fb72ae50307b42c8b619ee641cf1
"@nillion/nillion-client-js-browser@npm:^0.1.1":
version: 0.1.1
resolution: "@nillion/nillion-client-js-browser@npm:0.1.1"
checksum: 981e9acc9d56c688c3ec1d4d78559faa107e87b9f2d1f8f8835f75b7434a9ab94f6d9a9e6dd5b90e4de71b51662b31f1a21760b2c42083b650d4c3f1dc3373c9
languageName: node
linkType: hard

Expand Down Expand Up @@ -1931,7 +1931,7 @@ __metadata:
dependencies:
"@ethersproject/providers": ^5.7.2
"@heroicons/react": ^2.0.11
"@nillion/nillion-client-js-browser": ^0.0.9
"@nillion/nillion-client-js-browser": ^0.1.1
"@rainbow-me/rainbowkit": 1.3.5
"@trivago/prettier-plugin-sort-imports": ^4.1.1
"@types/node": ^17.0.35
Expand Down

0 comments on commit ed9363d

Please sign in to comment.