Installation
Initialisation
Options
Custom Package ID
After you deploy your own instance, pass the package ID as an override:Read Methods
getAgreement(agreementId)
Fetch a single agreement by its object ID.
Agreement
getRegistry()
Fetch the PactaRegistry shared object — global protocol statistics.
PactaRegistry
getAgreementsByCreator(creator)
Fetch all agreement IDs created by a given address, using on-chain events.
string[]
Write Methods
All write methods take asigner as the first argument. The signer is any object that has an address and a signAndExecuteTransaction method. This makes the SDK wallet-agnostic — use it with Sui dApp Kit, a Keypair, or a multisig signer.
createAgreement(signer, params)
Create a new agreement and share it on-chain.
setPartyB(signer, params)
Update party B’s address before they have deposited. Creator only.
depositCoin(signer, params)
Deposit a coin into the agreement. Works for both party A and party B — the contract resolves the party from the sender address.
approve(signer, params)
Record the caller’s approval to release funds.
settle(signer, params)
Trigger settlement. Any address can call this once all conditions are met.
cancel(signer, params)
Cancel the agreement.
- In
Createdstate: only the creator can cancel - In
Activestate: either party can cancel if only one has deposited
mutualCancel(signer, params)
Signal consent to a mutual cancel. Both parties must call this. When both have consented, the agreement cancels automatically.
cancelExpired(signer, agreementId)
Cancel an expired agreement. Anyone can call this after the expiryMs timestamp has passed.
raiseDispute(signer, params)
Raise a dispute on an active agreement. Either party can call this.
resolveDispute(signer, params)
Resolve a dispute. Only the arbiter can call this.
claimCoin(signer, params)
Claim your allocated coin after settlement or dispute resolution.
PTB Builder Methods
For advanced use — returns a rawTransaction object instead of signing immediately. Use this when you need to compose multiple operations in a single PTB before signing.
buildCreateAgreement, buildSetPartyB, buildDepositCoin, buildApprove,
buildSettle, buildCancel, buildMutualCancel, buildCancelExpired,
buildRaiseDispute, buildResolveDispute, buildClaimCoin