Skip to content

Commit 6b85129

Browse files
committed
feat(target_chains/sui): add iota js sdk
1 parent b1d7f3c commit 6b85129

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

target_chains/sui/sdk/js-iota/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@pythnetwork/pyth-iota-js",
33
"version": "2.1.0",
4-
"description": "Pyth Network Sui Utilities",
4+
"description": "Pyth Network IOTA Utilities",
55
"homepage": "https://pyth.network",
66
"author": {
77
"name": "Pyth Data Association"
@@ -14,7 +14,7 @@
1414
"repository": {
1515
"type": "git",
1616
"url": "https://github.com/pyth-network/pyth-crosschain",
17-
"directory": "target_chains/sui/sdk/js"
17+
"directory": "target_chains/sui/sdk/js-iota"
1818
},
1919
"publishConfig": {
2020
"access": "public"
@@ -31,7 +31,7 @@
3131
"keywords": [
3232
"pyth",
3333
"oracle",
34-
"sui"
34+
"iota"
3535
],
3636
"license": "Apache-2.0",
3737
"devDependencies": {
@@ -52,7 +52,7 @@
5252
"yargs": "^17.0.20"
5353
},
5454
"dependencies": {
55-
"@mysten/sui": "^1.3.0",
55+
"@iota/iota-sdk": "^0.5.0",
5656
"@pythnetwork/price-service-client": "workspace:*",
5757
"buffer": "^6.0.3"
5858
}

target_chains/sui/sdk/js-iota/src/SuiPriceServiceConnection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from "@pythnetwork/price-service-client";
55
import { Buffer } from "buffer";
66

7-
export class SuiPriceServiceConnection extends PriceServiceConnection {
7+
export class IotaPriceServiceConnection extends PriceServiceConnection {
88
/**
99
* Gets price update data (either batch price attestation VAAs or accumulator messages, depending on the chosen endpoint), which then
1010
* can be submitted to the Pyth contract to update the prices. This will throw an axios error if there is a network problem or

target_chains/sui/sdk/js-iota/src/client.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { SuiClient } from "@mysten/sui/client";
2-
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
3-
import { Transaction } from "@mysten/sui/transactions";
4-
import { bcs } from "@mysten/sui/bcs";
1+
import { IotaClient } from "@iota/iota-sdk/client";
2+
import { IOTA_CLOCK_OBJECT_ID } from "@iota/iota-sdk/utils";
3+
import { Transaction } from "@iota/iota-sdk/transactions";
4+
import { bcs } from "@iota/iota-sdk/bcs";
55
import { HexString } from "@pythnetwork/price-service-client";
66
import { Buffer } from "buffer";
77

88
const MAX_ARGUMENT_SIZE = 16 * 1024;
99
export type ObjectId = string;
1010

11-
export class SuiPythClient {
11+
export class IotaPythClient {
1212
private pythPackageId: ObjectId | undefined;
1313
private wormholePackageId: ObjectId | undefined;
1414
private priceTableInfo: { id: ObjectId; fieldType: ObjectId } | undefined;
1515
private priceFeedObjectIdCache: Map<HexString, ObjectId> = new Map();
1616
private baseUpdateFee: number | undefined;
1717
constructor(
18-
public provider: SuiClient,
18+
public provider: IotaClient,
1919
public pythStateId: ObjectId,
2020
public wormholeStateId: ObjectId
2121
) {
@@ -96,7 +96,7 @@ export class SuiPythClient {
9696
})
9797
.toBytes()
9898
),
99-
tx.object(SUI_CLOCK_OBJECT_ID),
99+
tx.object(IOTA_CLOCK_OBJECT_ID),
100100
],
101101
});
102102
verifiedVaas.push(verifiedVaa);
@@ -138,7 +138,7 @@ export class SuiPythClient {
138138
.toBytes()
139139
),
140140
verifiedVaas[0],
141-
tx.object(SUI_CLOCK_OBJECT_ID),
141+
tx.object(IOTA_CLOCK_OBJECT_ID),
142142
],
143143
});
144144

@@ -164,7 +164,7 @@ export class SuiPythClient {
164164
priceUpdatesHotPotato,
165165
tx.object(priceInfoObjectId),
166166
coins[coinId],
167-
tx.object(SUI_CLOCK_OBJECT_ID),
167+
tx.object(IOTA_CLOCK_OBJECT_ID),
168168
],
169169
});
170170
coinId++;
@@ -198,7 +198,7 @@ export class SuiPythClient {
198198
.toBytes()
199199
),
200200
verifiedVaas[0],
201-
tx.object(SUI_CLOCK_OBJECT_ID),
201+
tx.object(IOTA_CLOCK_OBJECT_ID),
202202
],
203203
});
204204
}

target_chains/sui/sdk/js-iota/src/examples/SuiRelay.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import yargs from "yargs";
22
import { hideBin } from "yargs/helpers";
3-
import { SuiClient } from "@mysten/sui/client";
4-
import { Transaction } from "@mysten/sui/transactions";
5-
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
3+
import { IotaClient } from "@iota/iota-sdk/client";
4+
import { Transaction } from "@iota/iota-sdk/transactions";
5+
import { Ed25519Keypair } from "@iota/iota-sdk/keypairs/ed25519";
66

77
import { Buffer } from "buffer";
8-
import { SuiPythClient } from "../client";
9-
import { SuiPriceServiceConnection } from "../index";
8+
import { IotaPythClient } from "../client";
9+
import { IotaPriceServiceConnection } from "../index";
1010

1111
const argvPromise = yargs(hideBin(process.argv))
1212
.option("feed-id", {
@@ -38,7 +38,7 @@ const argvPromise = yargs(hideBin(process.argv))
3838
}).argv;
3939

4040
export function getProvider(url: string) {
41-
return new SuiClient({ url });
41+
return new IotaClient({ url });
4242
}
4343
async function run() {
4444
if (process.env.SUI_KEY === undefined) {
@@ -48,14 +48,14 @@ async function run() {
4848
const argv = await argvPromise;
4949

5050
// Fetch the latest price feed update data from the Price Service
51-
const connection = new SuiPriceServiceConnection(argv["hermes"]);
51+
const connection = new IotaPriceServiceConnection(argv["hermes"]);
5252
const feeds = argv["feed-id"] as string[];
5353

5454
const provider = getProvider(argv["full-node"]);
5555
const wormholeStateId = argv["wormhole-state-id"];
5656
const pythStateId = argv["pyth-state-id"];
5757

58-
const client = new SuiPythClient(provider, pythStateId, wormholeStateId);
58+
const client = new IotaPythClient(provider, pythStateId, wormholeStateId);
5959
const newFeeds = [];
6060
const existingFeeds = [];
6161
for (const feed of feeds) {

target_chains/sui/sdk/js-iota/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export { SuiPriceServiceConnection } from "./SuiPriceServiceConnection";
2-
export { SuiPythClient } from "./client";
1+
export { IotaPriceServiceConnection } from "./SuiPriceServiceConnection";
2+
export { IotaPythClient } from "./client";
33

44
export {
55
DurationInMs,

0 commit comments

Comments
 (0)