Skip to content

Commit

Permalink
[sui] walrus blob id save api call
Browse files Browse the repository at this point in the history
  • Loading branch information
kairoski03 committed Nov 14, 2024
1 parent 06060d0 commit eed878e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/components/sui/Deploy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,32 @@ export const Deploy: React.FunctionComponent<InterfaceProps> = ({
'Content-Type': 'application/octet-stream',
},
})
.then((response) => {
.then(async (response) => {
console.log(
'Success (PUT https://publisher.walrus-testnet.walrus.space/v1/store): ',
response.data,
);
const result = response.data;
let walrusBlobId;
if (result.newlyCreated?.blobObject?.blobId) {
walrusBlobId = result.newlyCreated.blobObject.blobId;
} else if (result.alreadyCertified?.blobId) {
walrusBlobId = result.alreadyCertified.blobId;
} else {
console.error(`Not found walrus blobId`);
}

if (walrusBlobId) {
try {
const res = await axios.post(COMPILER_API_ENDPOINT + '/sui/walrus-blob-id', {
chainId: dapp.networks.sui.chain,
packageId: publishedChange.packageId,
blobId: walrusBlobId,
});
} catch (e) {
console.error(e);
}
}
})
.catch((error) => {
console.error(
Expand Down

0 comments on commit eed878e

Please sign in to comment.