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

Added MPC Support for extension #64

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
/logs
coverage
package-lock.json
src/mpcAccountDetails.json
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@sodot:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
111 changes: 111 additions & 0 deletions dist/bcs/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { BCS } from '@mysten/bcs';
import type { SuiObjectRef } from '../types/objects';
/**
* A reference to a shared object.
*/
export type SharedObjectRef = {
/** Hex code as string representing the object id */
objectId: string;
/** The version the object was shared at */
initialSharedVersion: number | string;
/** Whether reference is mutable */
mutable: boolean;
};
/**
* An object argument.
*/
export type ObjectArg = {
ImmOrOwned: SuiObjectRef;
} | {
Shared: SharedObjectRef;
};
/**
* A pure argument.
*/
export type PureArg = {
Pure: ArrayLike<number>;
};
export declare function isPureArg(arg: any): arg is PureArg;
/**
* An argument for the transaction. It is a 'meant' enum which expects to have
* one of the optional properties. If not, the BCS error will be thrown while
* attempting to form a transaction.
*
* Example:
* ```js
* let arg1: CallArg = { Object: { Shared: {
* objectId: '5460cf92b5e3e7067aaace60d88324095fd22944',
* initialSharedVersion: 1,
* mutable: true,
* } } };
* let arg2: CallArg = { Pure: bcs.ser(BCS.STRING, 100000).toBytes() };
* let arg3: CallArg = { Object: { ImmOrOwned: {
* objectId: '4047d2e25211d87922b6650233bd0503a6734279',
* version: 1,
* digest: 'bCiANCht4O9MEUhuYjdRCqRPZjr2rJ8MfqNiwyhmRgA='
* } } };
* ```
*
* For `Pure` arguments BCS is required. You must encode the values with BCS according
* to the type required by the called function. Pure accepts only serialized values
*/
export type CallArg = PureArg | {
Object: ObjectArg;
};
/**
* Kind of a TypeTag which is represented by a Move type identifier.
*/
export type StructTag = {
address: string;
module: string;
name: string;
typeParams: TypeTag[];
};
/**
* Sui TypeTag object. A decoupled `0x...::module::Type<???>` parameter.
*/
export type TypeTag = {
bool: null;
} | {
u8: null;
} | {
u64: null;
} | {
u128: null;
} | {
address: null;
} | {
signer: null;
} | {
vector: TypeTag;
} | {
struct: StructTag;
} | {
u16: null;
} | {
u32: null;
} | {
u256: null;
};
/**
* The GasData to be used in the transaction.
*/
export type GasData = {
payment: SuiObjectRef[];
owner: string;
price: number;
budget: number;
};
/**
* TransactionExpiration
*
* Indications the expiration time for a transaction.
*/
export type TransactionExpiration = {
None: null;
} | {
Epoch: number;
};
declare const bcs: BCS;
export { bcs };
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions dist/bcs/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 107 additions & 0 deletions dist/bcs/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/bcs/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions dist/builder/Inputs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import type { Infer } from 'superstruct';
import type { SharedObjectRef } from '../bcs/index';
import { SuiObjectRef } from '../types/index';
export declare const PureCallArg: import("superstruct").Struct<{
Pure: number[];
}, {
Pure: import("superstruct").Struct<number[], import("superstruct").Struct<number, null>>;
}>;
export declare const ObjectCallArg: import("superstruct").Struct<{
Object: {
ImmOrOwned: {
objectId: string;
version: string | number;
digest: string;
};
} | {
Shared: {
objectId: string;
initialSharedVersion: string | number;
mutable: boolean;
};
};
}, {
Object: import("superstruct").Struct<{
ImmOrOwned: {
objectId: string;
version: string | number;
digest: string;
};
} | {
Shared: {
objectId: string;
initialSharedVersion: string | number;
mutable: boolean;
};
}, null>;
}>;
export type PureCallArg = Infer<typeof PureCallArg>;
export type ObjectCallArg = Infer<typeof ObjectCallArg>;
export declare const BuilderCallArg: import("superstruct").Struct<{
Pure: number[];
} | {
Object: {
ImmOrOwned: {
objectId: string;
version: string | number;
digest: string;
};
} | {
Shared: {
objectId: string;
initialSharedVersion: string | number;
mutable: boolean;
};
};
}, null>;
export type BuilderCallArg = Infer<typeof BuilderCallArg>;
export declare const Inputs: {
Pure(data: unknown, type?: string): PureCallArg;
ObjectRef({ objectId, digest, version }: SuiObjectRef): ObjectCallArg;
SharedObjectRef({ objectId, mutable, initialSharedVersion, }: SharedObjectRef): ObjectCallArg;
};
export declare function getIdFromCallArg(arg: string | ObjectCallArg): string;
export declare function getSharedObjectInput(arg: BuilderCallArg): SharedObjectRef | undefined;
export declare function isSharedObjectInput(arg: BuilderCallArg): boolean;
export declare function isMutableSharedObjectInput(arg: BuilderCallArg): boolean;
//# sourceMappingURL=Inputs.d.ts.map
1 change: 1 addition & 0 deletions dist/builder/Inputs.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions dist/builder/Inputs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/builder/Inputs.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading