Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mysten/kiosk

Package Overview
Dependencies
Maintainers
4
Versions
326
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mysten/kiosk - npm Package Compare versions

Comparing version 0.0.0-experimental-20230605192356 to 0.0.0-experimental-20230608160656

27

./dist/index.js

@@ -51,2 +51,3 @@ "use strict";

fetchKiosk: () => fetchKiosk,
getAllDynamicFields: () => getAllDynamicFields,
getKioskObject: () => getKioskObject,

@@ -236,2 +237,18 @@ getRulePackageAddress: () => getRulePackageAddress,

}
async function getAllDynamicFields(provider, parentId, pagination) {
let hasNextPage = true;
let cursor = void 0;
const data = [];
while (hasNextPage) {
const result = await provider.getDynamicFields({
parentId,
limit: pagination.limit || void 0,
cursor
});
data.push(...result.data);
hasNextPage = result.hasNextPage;
cursor = result.nextCursor;
}
return data;
}

@@ -505,6 +522,3 @@ // src/tx/transfer-policy.ts

async function fetchKiosk(provider, kioskId, pagination, options) {
const { data, nextCursor, hasNextPage } = await provider.getDynamicFields({
parentId: kioskId,
...pagination
});
const data = await getAllDynamicFields(provider, kioskId, pagination);
const listings = [];

@@ -528,4 +542,4 @@ const lockedItemIds = [];

data: kioskData,
nextCursor,
hasNextPage
nextCursor: null,
hasNextPage: false
};

@@ -592,2 +606,3 @@ }

fetchKiosk,
getAllDynamicFields,
getKioskObject,

@@ -594,0 +609,0 @@ getRulePackageAddress,

# @mysten/kiosk
## 0.0.0-experimental-20230605192356
## 0.0.0-experimental-20230608160656
### Patch Changes
- abf6ad381e: Refactor the fetchKiosk function to return all content instead of paginating, to prevent missing data
## 0.3.0
### Minor Changes

@@ -12,3 +18,3 @@

- Updated dependencies [09d77325a9]
- @mysten/sui.js@0.0.0-experimental-20230605192356
- @mysten/sui.js@0.35.1

@@ -15,0 +21,0 @@ ## 0.2.0

@@ -51,2 +51,3 @@ "use strict";

fetchKiosk: () => fetchKiosk,
getAllDynamicFields: () => getAllDynamicFields,
getKioskObject: () => getKioskObject,

@@ -236,2 +237,18 @@ getRulePackageAddress: () => getRulePackageAddress,

}
async function getAllDynamicFields(provider, parentId, pagination) {
let hasNextPage = true;
let cursor = void 0;
const data = [];
while (hasNextPage) {
const result = await provider.getDynamicFields({
parentId,
limit: pagination.limit || void 0,
cursor
});
data.push(...result.data);
hasNextPage = result.hasNextPage;
cursor = result.nextCursor;
}
return data;
}

@@ -505,6 +522,3 @@ // src/tx/transfer-policy.ts

async function fetchKiosk(provider, kioskId, pagination, options) {
const { data, nextCursor, hasNextPage } = await provider.getDynamicFields({
parentId: kioskId,
...pagination
});
const data = await getAllDynamicFields(provider, kioskId, pagination);
const listings = [];

@@ -528,4 +542,4 @@ const lockedItemIds = [];

data: kioskData,
nextCursor,
hasNextPage
nextCursor: null,
hasNextPage: false
};

@@ -592,2 +606,3 @@ }

fetchKiosk,
getAllDynamicFields,
getKioskObject,

@@ -594,0 +609,0 @@ getRulePackageAddress,

@@ -1,2 +0,2 @@

import { JsonRpcProvider, ObjectId, SharedObjectRef, SuiObjectRef, SuiObjectResponse, TransactionArgument, TransactionBlock } from '@mysten/sui.js';
import { JsonRpcProvider, ObjectId, PaginationArguments, SharedObjectRef, SuiObjectRef, SuiObjectResponse, TransactionArgument, TransactionBlock } from '@mysten/sui.js';
import { KioskData, KioskListing } from './query/kiosk';

@@ -34,1 +34,18 @@ import { DynamicFieldInfo } from '@mysten/sui.js/dist/types/dynamic_fields';

export declare function getRulePackageAddress(environment: RulesEnvironmentParam): string;
/**
* A helper to fetch all DF pages.
* We need that to fetch the kiosk DFs consistently, until we have
* RPC calls that allow filtering of Type / batch fetching of spec
*/
export declare function getAllDynamicFields(provider: JsonRpcProvider, parentId: ObjectId, pagination: PaginationArguments<string>): Promise<{
type: "DynamicField" | "DynamicObject";
objectType: string;
objectId: string;
version: number;
digest: string;
name: {
type: string;
value?: any;
};
bcsName: string;
}[]>;

@@ -5,3 +5,3 @@ {

"description": "Sui Kiosk library",
"version": "0.0.0-experimental-20230605192356",
"version": "0.0.0-experimental-20230608160656",
"license": "Apache-2.0",

@@ -28,3 +28,3 @@ "main": "./dist/index.js",

"dependencies": {
"@mysten/sui.js": "0.0.0-experimental-20230605192356"
"@mysten/sui.js": "0.35.1"
},

@@ -31,0 +31,0 @@ "devDependencies": {

@@ -36,16 +36,10 @@ # Kiosk SDK

const {
data: res,
nextCursor,
hasNextPage,
} = await fetchKiosk(
const { data } = await fetchKiosk(
provider,
kioskAddress,
{ limit: 100 },
{}, // empty pagination, currently disabled.
{ withListingPrices: true, withKioskFields: true },
); // could also add `cursor` for pagination
);
console.log(res); // { items: [], itemIds: [], listingIds: [], kiosk: {...} }
console.log(nextCursor); // null
console.log(hasNextPage); // false
console.log(data); // { items: [], itemIds: [], listingIds: [], kiosk: {...} }
};

@@ -52,0 +46,0 @@ ```

@@ -15,2 +15,3 @@ // Copyright (c) Mysten Labs, Inc.

extractKioskData,
getAllDynamicFields,
getKioskObject,

@@ -81,6 +82,7 @@ } from '../utils';

): Promise<PagedKioskData> {
const { data, nextCursor, hasNextPage } = await provider.getDynamicFields({
parentId: kioskId,
...pagination,
});
// TODO: Replace the `getAllDynamicFields` with a paginated
// response, once we have better RPC support for
// type filtering & batch fetching.
// This can't work with pagination currently.
const data = await getAllDynamicFields(provider, kioskId, pagination);

@@ -118,5 +120,5 @@ const listings: KioskListing[] = [];

data: kioskData,
nextCursor,
hasNextPage,
nextCursor: null,
hasNextPage: false,
};
}

@@ -7,2 +7,3 @@ // Copyright (c) Mysten Labs, Inc.

ObjectId,
PaginationArguments,
SharedObjectRef,

@@ -190,1 +191,29 @@ SuiObjectRef,

}
/**
* A helper to fetch all DF pages.
* We need that to fetch the kiosk DFs consistently, until we have
* RPC calls that allow filtering of Type / batch fetching of spec
*/
export async function getAllDynamicFields(
provider: JsonRpcProvider,
parentId: ObjectId,
pagination: PaginationArguments<string>,
) {
let hasNextPage = true;
let cursor = undefined;
const data: DynamicFieldInfo[] = [];
while (hasNextPage) {
const result = await provider.getDynamicFields({
parentId,
limit: pagination.limit || undefined,
cursor,
});
data.push(...result.data);
hasNextPage = result.hasNextPage;
cursor = result.nextCursor;
}
return data;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc