diff --git a/src/example.ts b/src/example.ts index 9757ea4..e241024 100644 --- a/src/example.ts +++ b/src/example.ts @@ -1,5 +1,4 @@ -import { HexString, AptosAccount } from "./index"; -import * as supraSDK from "./index"; +import { HexString, SupraAccount, SupraClient } from "./index"; // To run this example, install `ts-node` (e.g. `npm install -g ts-node`), enter the directory // that contains this file and run `ts-node ./example.ts`. @@ -14,12 +13,12 @@ import * as supraSDK from "./index"; // To Create Instance Of Supra Client, But In This Method We Don't Need To Pass ChainId. // ChainId Will Be Identified At Instance Creation Time By Making RPC Call. - let supraClient = await supraSDK.SupraClient.init( + let supraClient = await SupraClient.init( // "http://localhost:27001/" "https://rpc-testnet.supra.com/" ); - let senderAccount = new AptosAccount( + let senderAccount = new SupraAccount( Buffer.from( "2b9654793a999d1d487dabbd1b8f194156e15281fa1952af121cc97b27578d89", "hex" diff --git a/src/index.ts b/src/index.ts index eee8533..454e931 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,9 @@ -import { TxnBuilderTypes, BCS, HexString, AptosAccount } from "aptos"; +import { + TxnBuilderTypes, + BCS, + HexString, + AptosAccount as SupraAccount, +} from "aptos"; import axios, { AxiosResponse } from "axios"; import { normalizeAddress, @@ -22,7 +27,7 @@ import { import { sha3_256 } from "js-sha3"; export * from "./types"; -export { TxnBuilderTypes, BCS, HexString, AptosAccount }; +export { TxnBuilderTypes, BCS, HexString, SupraAccount }; /** * Provides methods for interacting with supra rpc node. @@ -692,7 +697,7 @@ export class SupraClient { } private signSupraTransaction( - senderAccount: AptosAccount, + senderAccount: SupraAccount, rawTxn: TxnBuilderTypes.RawTransaction ) { let preHash = Uint8Array.from( @@ -712,7 +717,7 @@ export class SupraClient { } private async getSendTxPayload( - senderAccount: AptosAccount, + senderAccount: SupraAccount, rawTxn: TxnBuilderTypes.RawTransaction ): Promise { console.log("Sequence Number: ", rawTxn.sequence_number); @@ -759,7 +764,7 @@ export class SupraClient { * @returns `TransactionResponse` */ async sendTxUsingSerializedRawTransaction( - senderAccount: AptosAccount, + senderAccount: SupraAccount, serializedRawTransaction: Uint8Array ): Promise { let sendTxPayload = await this.getSendTxPayload( @@ -861,7 +866,7 @@ export class SupraClient { * @returns `TransactionResponse` */ async transferSupraCoin( - senderAccount: AptosAccount, + senderAccount: SupraAccount, receiverAccountAddr: HexString, amount: bigint, waitForTransactionCompletion: boolean = false @@ -909,7 +914,7 @@ export class SupraClient { * @returns `TransactionResponse` */ async transferCoin( - senderAccount: AptosAccount, + senderAccount: SupraAccount, receiverAccountAddr: HexString, amount: bigint, coinType: string, @@ -957,7 +962,7 @@ export class SupraClient { * @returns `TransactionResponse` */ async publishPackage( - senderAccount: AptosAccount, + senderAccount: SupraAccount, packageMetadata: Uint8Array, modulesCode: Uint8Array[] ): Promise {