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

feat: contract/abi changes for testnet v0.1.5 #116

Merged
merged 5 commits into from
Mar 20, 2025
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
7 changes: 7 additions & 0 deletions .changeset/wet-beds-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@recallnet/network-constants": patch
"@recallnet/contracts": patch
"@recallnet/sdk": patch
---

testnet v0.1.5 updates with new contract addresses and ABI changes for buckets and blobs
74 changes: 24 additions & 50 deletions packages/contracts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,43 +88,12 @@ export const blobManagerAbi = [
internalType: "struct Subscriber[]",
type: "tuple[]",
components: [
{ name: "subscriber", internalType: "address", type: "address" },
{
name: "subscriptionGroup",
internalType: "struct SubscriptionGroup[]",
type: "tuple[]",
components: [
{
name: "subscriptionId",
internalType: "string",
type: "string",
},
{
name: "subscription",
internalType: "struct Subscription",
type: "tuple",
components: [
{ name: "added", internalType: "uint64", type: "uint64" },
{
name: "expiry",
internalType: "uint64",
type: "uint64",
},
{
name: "source",
internalType: "string",
type: "string",
},
{
name: "delegate",
internalType: "address",
type: "address",
},
{ name: "failed", internalType: "bool", type: "bool" },
],
},
],
name: "subscriptionId",
internalType: "string",
type: "string",
},
{ name: "expiry", internalType: "uint64", type: "uint64" },
],
},
{ name: "status", internalType: "enum BlobStatus", type: "uint8" },
Expand Down Expand Up @@ -278,7 +247,7 @@ export const blobManagerAbi = [

*/
export const blobManagerAddress = {
2481632: "0xDE2b390bba012f028B75A45190ed28a2838633e3",
2481632: "0x6E3f94065567560c6e1Bbc5e4584127220c15e14",
248163216: "0x8ce361602B935680E8DeC218b820ff5056BeB7af",
} as const;

Expand Down Expand Up @@ -495,6 +464,7 @@ export const bucketManagerAbi = [
components: [
{ name: "blobHash", internalType: "string", type: "string" },
{ name: "size", internalType: "uint64", type: "uint64" },
{ name: "expiry", internalType: "uint64", type: "uint64" },
{
name: "metadata",
internalType: "struct KeyValue[]",
Expand Down Expand Up @@ -548,6 +518,7 @@ export const bucketManagerAbi = [
components: [
{ name: "blobHash", internalType: "string", type: "string" },
{ name: "size", internalType: "uint64", type: "uint64" },
{ name: "expiry", internalType: "uint64", type: "uint64" },
{
name: "metadata",
internalType: "struct KeyValue[]",
Expand Down Expand Up @@ -599,6 +570,7 @@ export const bucketManagerAbi = [
components: [
{ name: "blobHash", internalType: "string", type: "string" },
{ name: "size", internalType: "uint64", type: "uint64" },
{ name: "expiry", internalType: "uint64", type: "uint64" },
{
name: "metadata",
internalType: "struct KeyValue[]",
Expand Down Expand Up @@ -651,6 +623,7 @@ export const bucketManagerAbi = [
components: [
{ name: "blobHash", internalType: "string", type: "string" },
{ name: "size", internalType: "uint64", type: "uint64" },
{ name: "expiry", internalType: "uint64", type: "uint64" },
{
name: "metadata",
internalType: "struct KeyValue[]",
Expand Down Expand Up @@ -701,6 +674,7 @@ export const bucketManagerAbi = [
components: [
{ name: "blobHash", internalType: "string", type: "string" },
{ name: "size", internalType: "uint64", type: "uint64" },
{ name: "expiry", internalType: "uint64", type: "uint64" },
{
name: "metadata",
internalType: "struct KeyValue[]",
Expand Down Expand Up @@ -751,7 +725,7 @@ export const bucketManagerAbi = [

*/
export const bucketManagerAddress = {
2481632: "0x4ce14F0751287Bfcd3ba4A8Ddb46DdA5d36a0b7E",
2481632: "0x7a9Cec860adF2C64274D0aD7fbF0b5Bf0426a200",
248163216: "0xeD1DB453C3156Ff3155a97AD217b3087D5Dc5f6E",
} as const;

Expand Down Expand Up @@ -1101,7 +1075,7 @@ export const creditManagerAbi = [

*/
export const creditManagerAddress = {
2481632: "0x7E6855FF43C2A434707eE9Ff031d450cceB2EcbE",
2481632: "0x61F50eEC83043a4635956B54EEDf5Eea8CcaBc76",
248163216: "0x196dBCBb54b8ec4958c959D8949EBFE87aC2Aaaf",
} as const;

Expand All @@ -1119,7 +1093,7 @@ export const creditManagerConfig = {

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x51eFd78d5B742e730A94e4525dbee97015bEf746)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x136066500b332e7D72643EE7690E9C708702c7e6)
*/
export const gatewayManagerFacetAbi = [
{
Expand Down Expand Up @@ -1366,19 +1340,19 @@ export const gatewayManagerFacetAbi = [

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x51eFd78d5B742e730A94e4525dbee97015bEf746)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x136066500b332e7D72643EE7690E9C708702c7e6)
*/
export const gatewayManagerFacetAddress = {
31337: "0x9A676e781A523b5d0C0e43731313A708CB607508",
314159: "0x51eFd78d5B742e730A94e4525dbee97015bEf746",
314159: "0x136066500b332e7D72643EE7690E9C708702c7e6",
2481632: "0x77Aa40B105843728088c0132e43FC44348881DA8",
248163216: "0x77Aa40B105843728088c0132e43FC44348881DA8",
1942764459484029: "0x77Aa40B105843728088c0132e43FC44348881DA8",
} as const;

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x51eFd78d5B742e730A94e4525dbee97015bEf746)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x136066500b332e7D72643EE7690E9C708702c7e6)
*/
export const gatewayManagerFacetConfig = {
address: gatewayManagerFacetAddress,
Expand Down Expand Up @@ -1432,7 +1406,7 @@ export const iMachineFacadeAbi = [

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x09f2A3ed21BA70E532F96b57a8733309Cc9087B4)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x9E5ea73a639484CcE57F865dC1E582Cd01F3251F)
*/
export const recallErc20Abi = [
{
Expand Down Expand Up @@ -1534,16 +1508,16 @@ export const recallErc20Abi = [

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x09f2A3ed21BA70E532F96b57a8733309Cc9087B4)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x9E5ea73a639484CcE57F865dC1E582Cd01F3251F)
*/
export const recallErc20Address = {
31337: "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
314159: "0x09f2A3ed21BA70E532F96b57a8733309Cc9087B4",
314159: "0x9E5ea73a639484CcE57F865dC1E582Cd01F3251F",
} as const;

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x09f2A3ed21BA70E532F96b57a8733309Cc9087B4)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x9E5ea73a639484CcE57F865dC1E582Cd01F3251F)
*/
export const recallErc20Config = {
address: recallErc20Address,
Expand All @@ -1556,7 +1530,7 @@ export const recallErc20Config = {

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x49E26a7e9B5e9b428D259d7D6644d22C6f6FC14E)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0xdf3Fe12002826Ff617F2d7500c61B72A8e3E9436)
*/
export const subnetGetterFacetAbi = [
{
Expand Down Expand Up @@ -1687,19 +1661,19 @@ export const subnetGetterFacetAbi = [

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x49E26a7e9B5e9b428D259d7D6644d22C6f6FC14E)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0xdf3Fe12002826Ff617F2d7500c61B72A8e3E9436)
*/
export const subnetGetterFacetAddress = {
31337: "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
314159: "0x49E26a7e9B5e9b428D259d7D6644d22C6f6FC14E",
314159: "0xdf3Fe12002826Ff617F2d7500c61B72A8e3E9436",
2481632: "0x74539671A1D2F1c8f200826bAbA665179F53a1b7",
248163216: "0x74539671A1D2F1c8f200826bAbA665179F53a1b7",
1942764459484029: "0x74539671A1D2F1c8f200826bAbA665179F53a1b7",
} as const;

/**
* -
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0x49E26a7e9B5e9b428D259d7D6644d22C6f6FC14E)
* - [__View Contract on Filecoin Calibration Filscan__](https://calibration.filscan.io/address/0xdf3Fe12002826Ff617F2d7500c61B72A8e3E9436)
*/
export const subnetGetterFacetConfig = {
address: subnetGetterFacetAddress,
Expand Down
14 changes: 7 additions & 7 deletions packages/network-constants/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Subnet IDs
export const TESTNET_SUBNET_ID =
"/r314159/t410fr65mgmqd6t7o2u3x3ptpjsd4olrrmzddkwkj2ta";
"/r314159/t410frrql2ooeoz2t4hlor3hqw33druwnc4jzhajdbeq";
export const LOCALNET_SUBNET_ID =
"/r31337/t410f6gbdxrbehnaeeo4mrq7wc5hgq6smnefys4qanwi";
export const DEVNET_SUBNET_ID = "test";
Expand Down Expand Up @@ -53,7 +53,7 @@ export const MAX_OBJECT_SIZE = 5_000_000_000; // 5GB

// Gateway Manager Facet contract addresses
export const TESTNET_PARENT_GATEWAY_MANAGER_FACET_ADDRESS =
"0x51eFd78d5B742e730A94e4525dbee97015bEf746";
"0x136066500b332e7D72643EE7690E9C708702c7e6";
export const TESTNET_GATEWAY_MANAGER_FACET_ADDRESS =
"0x77aa40b105843728088c0132e43fc44348881da8";
export const LOCALNET_PARENT_GATEWAY_MANAGER_FACET_ADDRESS =
Expand All @@ -65,7 +65,7 @@ export const DEVNET_GATEWAY_MANAGER_FACET_ADDRESS =

// Subnet Getter (Registry) Facet contract addresses
export const TESTNET_PARENT_SUBNET_GETTER_FACET_ADDRESS =
"0x49E26a7e9B5e9b428D259d7D6644d22C6f6FC14E";
"0xdf3Fe12002826Ff617F2d7500c61B72A8e3E9436";
export const LOCALNET_PARENT_SUBNET_GETTER_FACET_ADDRESS =
"0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44";
export const TESTNET_SUBNET_GETTER_FACET_ADDRESS =
Expand All @@ -77,24 +77,24 @@ export const DEVNET_SUBNET_GETTER_FACET_ADDRESS =

// ERC20 contract addresses
export const TESTNET_PARENT_ERC20_ADDRESS =
"0x09f2A3ed21BA70E532F96b57a8733309Cc9087B4";
"0x9E5ea73a639484CcE57F865dC1E582Cd01F3251F";
export const LOCALNET_PARENT_ERC20_ADDRESS =
"0x4A679253410272dd5232B3Ff7cF5dbB88f295319";

// BlobManager contract addresses
export const TESTNET_BLOB_MANAGER_ADDRESS =
"0xDE2b390bba012f028B75A45190ed28a2838633e3";
"0x6E3f94065567560c6e1Bbc5e4584127220c15e14";
export const LOCALNET_BLOB_MANAGER_ADDRESS =
"0x8ce361602B935680E8DeC218b820ff5056BeB7af";

// BucketManager contract addresses
export const TESTNET_BUCKET_MANAGER_ADDRESS =
"0x4ce14F0751287Bfcd3ba4A8Ddb46DdA5d36a0b7E";
"0x7a9Cec860adF2C64274D0aD7fbF0b5Bf0426a200";
export const LOCALNET_BUCKET_MANAGER_ADDRESS =
"0xeD1DB453C3156Ff3155a97AD217b3087D5Dc5f6E";

// CreditManager contract addresses
export const TESTNET_CREDIT_MANAGER_ADDRESS =
"0x7E6855FF43C2A434707eE9Ff031d450cceB2EcbE";
"0x61F50eEC83043a4635956B54EEDf5Eea8CcaBc76";
export const LOCALNET_CREDIT_MANAGER_ADDRESS =
"0x196dBCBb54b8ec4958c959D8949EBFE87aC2Aaaf";
1 change: 1 addition & 0 deletions packages/sdk/src/entities/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ export class BucketManager {
state: {
blobHash: state.blobHash,
size: state.size,
expiry: state.expiry,
metadata: convertAbiMetadataToObject(state.metadata),
},
})),
Expand Down
25 changes: 19 additions & 6 deletions packages/sdk/test/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ describe("contracts", function () {
let bucket: Address; // Note: FVM uses all lowercase, but viem returns the checksummed address (may include uppercase)
const key = "hello/world";
const fileContents = "hello\n";
const blobHash = "rzghyg4z3p6vbz5jkgc75lk64fci7kieul65o6hk6xznx7lctkmq";

before(async () => {
({
result: { bucket },
} = await bucketManager.create());
});

it("should add object from file", async () => {
it("should add object from file with metadata and overwrite", async () => {
const path = await temporaryWrite(fileContents);
const opts = {
metadata: {
foo: "bar",
},
overwrite: true,
};
const { meta } = await bucketManager.add(bucket, key, path, opts);
strictEqual(isHash(meta!.tx!.transactionHash), true);
Expand All @@ -127,7 +127,7 @@ describe("contracts", function () {
bucket,
key,
);
strictEqual(object.blobHash, blobHash);
expect(object.blobHash).to.be.a("string");
strictEqual(object.size, 6n);

// at a specific block number
Expand All @@ -137,7 +137,7 @@ describe("contracts", function () {
key,
latestBlock,
));
strictEqual(object.blobHash, blobHash);
expect(object.blobHash).to.be.a("string");
strictEqual(object.size, 6n);
});

Expand Down Expand Up @@ -263,7 +263,8 @@ describe("contracts", function () {
expect(objects.length).to.be.greaterThan(0);
strictEqual(objects[0]?.key, key);
strictEqual(objects[0]?.state?.size, 6n);
strictEqual(objects[0]?.state?.blobHash, blobHash);
expect(Number(objects[0]?.state?.expiry)).to.be.greaterThan(0);
expect(objects[0]?.state?.blobHash).to.be.a("string");
strictEqual(commonPrefixes.length, 0);

// no objects with prefix
Expand Down Expand Up @@ -509,12 +510,24 @@ describe("contracts", function () {
const to = getAddress("0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc");
const subscriptionId = "foobar";
const size = 6n;
const blobHash = "rzghyg4z3p6vbz5jkgc75lk64fci7kieul65o6hk6xznx7lctkmq";
let blobHash: string;

before(async () => {
blobs = client.blobManager(
(BLOB_MANAGER_ADDRESS as Address) ?? undefined,
);
const bucketManager = client.bucketManager(
(BUCKET_MANAGER_ADDRESS as Address) ?? undefined,
);
const fileContents = "hello\n";
const key = "hello/world";
const {
result: { bucket },
} = await bucketManager.create();
const path = await temporaryWrite(fileContents);
await bucketManager.add(bucket, key, path);
const { result } = await bucketManager.getObjectValue(bucket, key);
blobHash = result.blobHash;
});

it("should get added blobs", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdkx/src/react/buckets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export function useAddFile() {
source: uploadRes.node_id,
key: args.key,
blobHash: uploadRes.hash,
recoveryHash: "",
recoveryHash: uploadRes.metadata_hash,
size: BigInt(args.file.size),
ttl: args.options?.ttl ?? 0n,
metadata,
Expand Down
Loading