Skip to content

Commit

Permalink
changed dynamic arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnetwork committed May 9, 2024
1 parent 36d39e4 commit 80846eb
Show file tree
Hide file tree
Showing 115 changed files with 1,486 additions and 1,434 deletions.
2 changes: 1 addition & 1 deletion .dart_tool/extension_discovery/vs_code.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":2,"entries":[{"package":"blockchain_utils","rootUri":"../../bitcoin/blockchain_utils/","packageUri":"lib/"},{"package":"xrpl_dart","rootUri":"../","packageUri":"lib/"}]}
{"version":2,"entries":[{"package":"xrpl_dart","rootUri":"../","packageUri":"lib/"}]}
Binary file added .dart_tool/pub/bin/test/test.dart-3.3.3.snapshot
Binary file not shown.
Binary file modified .dart_tool/test/incremental_kernel.Ly9AZGFydD0yLjE1
Binary file not shown.
4 changes: 2 additions & 2 deletions example/lib/examples/amm/amm_bid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Future<void> _ammBitWithAuthAccount(QuickWallet wallet, XRPCurrencies assets,
{CurrencyAmount? bidMin, CurrencyAmount? bidMax}) async {
final transaction = AMMBid(
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
asset: assets,
asset2: assets2,
memos: [exampleMemo],
Expand All @@ -64,7 +64,7 @@ Future<void> _ammBid(
QuickWallet wallet, XRPCurrencies assets, XRPCurrencies assets2) async {
final transaction = AMMBid(
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
asset: assets,
asset2: assets2,
memos: [exampleMemo]);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/examples/amm/amm_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void ammCreate() async {
Future<void> accountSet(QuickWallet wallet) async {
final transaction = AccountSet(
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
setFlag: AccountSetAsfFlag.asfDefaultRipple,
memos: [exampleMemo]);
await XRPHelper.autoFill(wallet.rpc, transaction);
Expand All @@ -37,7 +37,7 @@ Future<void> accountSet(QuickWallet wallet) async {
Future<void> trustSet(QuickWallet wallet, String issuer) async {
final transaction = TrustSet(
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
flags: TrustSetFlag.tfClearNoRipple.value,
limitAmount:
IssuedCurrencyAmount(value: "1000", currency: "USD", issuer: issuer),
Expand All @@ -61,7 +61,7 @@ Future<void> payment(
QuickWallet wallet, String issuer, String destionation) async {
final transaction = Payment(
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
flags: TrustSetFlag.tfClearNoRipple.value,
destination: destionation,
amount: CurrencyAmount.issue(
Expand All @@ -86,7 +86,7 @@ Future<void> _ammCreate(QuickWallet wallet, String issuer,
{String currencyCode = "USD"}) async {
final transaction = AMMCreate(
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
tradingFee: 12,
amount: CurrencyAmount.xrp(BigInt.from(250)),
amount2: CurrencyAmount.issue(IssuedCurrencyAmount(
Expand Down
2 changes: 1 addition & 1 deletion example/lib/examples/amm/amm_vote.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Future<void> _ammVote(QuickWallet wallet, XRPCurrencies assets,
XRPCurrencies assets2, int tradingFee) async {
final transaction = AMMVote(
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
tradingFee: tradingFee,
asset: assets,
asset2: assets2,
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/check/check_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Future<void> checkCreate(
sendMax: sendMax,
destination: destination,
account: account.address,
signingPubKey: account.pubHex,
signer: XRPLSignature.signer(account.pubHex),
memos: [exampleMemo],
);
print("autfil trnsction");
Expand Down Expand Up @@ -64,7 +64,7 @@ Future<void> cancelCheck(QuickWallet account) async {

final transaction = CheckCancel(
account: account.address,
signingPubKey: account.pubHex,
signer: XRPLSignature.signer(account.pubHex),
checkId: checkIndex,
memos: [exampleMemo],
);
Expand Down Expand Up @@ -100,7 +100,7 @@ Future<void> chechCash(QuickWallet destination,
final String checkIndex = checkInfo["account_objects"][0]["index"];
final transction = CheckCash(
account: destination.address,
signingPubKey: destination.pubHex,
signer: XRPLSignature.signer(destination.pubHex),
amount: amount,
checkId: checkIndex,
memos: [exampleMemo],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ void deleteAccountExample() async {

Future<void> deleteAccount(QuickWallet account, String destionation) async {
final transaction = AccountDelete(
account: account.address,
memos: [exampleMemo],
destination: destionation,
signingPubKey: account.pubHex);
account: account.address,
memos: [exampleMemo],
destination: destionation,
signer: XRPLSignature.signer(account.pubHex),
);
await XRPHelper.autoFill(account.rpc, transaction);
final blob = transaction.toBlob();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ void depositePreAuth() async {

Future<void> authorize(QuickWallet account, String autorize) async {
final transaction = DepositPreauth(
account: account.address,
authorize: autorize,
memos: [exampleMemo],
signingPubKey: account.pubHex);
account: account.address,
authorize: autorize,
memos: [exampleMemo],
signer: XRPLSignature.signer(account.pubHex),
);
await XRPHelper.autoFill(account.rpc, transaction);
final blob = transaction.toBlob();

Expand All @@ -42,10 +43,11 @@ Future<void> authorize(QuickWallet account, String autorize) async {

Future<void> unauthorize(QuickWallet account, String autorize) async {
final transaction = DepositPreauth(
account: account.address,
unauthorize: autorize,
memos: [exampleMemo],
signingPubKey: account.pubHex);
account: account.address,
unauthorize: autorize,
memos: [exampleMemo],
signer: XRPLSignature.signer(account.pubHex),
);
await XRPHelper.autoFill(account.rpc, transaction);
final blob = transaction.toBlob();

Expand Down
2 changes: 1 addition & 1 deletion example/lib/examples/did/did_delete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void didDelete() async {

final transaction = DIDDelete(
account: masterWallet.address,
signingPubKey: masterWallet.pubHex,
signer: XRPLSignature.signer(masterWallet.pubHex),
memos: [exampleMemo]);
await XRPHelper.autoFill(masterWallet.rpc, transaction);
final blob = transaction.toBlob();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/examples/did/did_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void didset() async {

final transaction = DIDSet(
account: masterWallet.address,
signingPubKey: masterWallet.pubHex,
signer: XRPLSignature.signer(masterWallet.pubHex),
didDocument: validField,
data: validField,
uri: validField,
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/escrow/escrow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Future<void> escrowCreate(QuickWallet owner, String destination,
finishAfterTime: finishAfterOneHours,
amount: XRPHelper.xrpDecimalToDrop("1200"),
condition: condition,
signingPubKey: owner.pubHex,
signer: XRPLSignature.signer(owner.pubHex),
memos: [exampleMemo],
);
print("autfil trnsction");
Expand Down Expand Up @@ -64,7 +64,7 @@ Future<void> finisScrow(QuickWallet destination, String owner,
account: destination.address,
condition: condition,
fulfillment: fulfillment,
signingPubKey: destination.pubHex,
signer: XRPLSignature.signer(destination.pubHex),
owner: owner,
memos: [exampleMemo],
);
Expand Down Expand Up @@ -97,7 +97,7 @@ Future<void> cancelScrow(QuickWallet owner) async {
owner: owner.address,
offerSequence: 2500937, // sequance of create escrow transaction
account: owner.address,
signingPubKey: owner.pubHex,
signer: XRPLSignature.signer(owner.pubHex),
memos: [exampleMemo],
);
print("autfil trnsction");
Expand Down
33 changes: 21 additions & 12 deletions example/lib/examples/multisig/multisig.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Future<void> createOrUpdateMultiSIgAccount(
signerEntries: signers,
account: masterWallet.address,
signerQuorum: threshold,
signingPubKey: masterWallet.pubHex,
signer: XRPLSignature.signer(masterWallet.pubHex),
memos: [exampleMemo]);
print("autofill trnsction");
await XRPHelper.autoFill(masterWallet.rpc, transaction);
Expand All @@ -112,7 +112,7 @@ Future<void> createOrUpdateMultiSIgAccount(
Future<void> disableMaster(QuickWallet masterWallet) async {
final transaction = AccountSet(
account: masterWallet.address,
signingPubKey: masterWallet.pubHex,
signer: XRPLSignature.signer(masterWallet.pubHex),
setFlag: AccountSetAsfFlag.asfDisableMaster,
memos: [exampleMemo]);
await XRPHelper.autoFill(masterWallet.rpc, transaction);
Expand All @@ -139,19 +139,24 @@ Future<void> disableMaster(QuickWallet masterWallet) async {
Future<void> sendXRPLUsingMultiSig(QuickWallet masaterWallet,
String destination, List<QuickWallet> signersList, int signerQuorum) async {
final transaction = Payment(
destination: destination,
multiSigSigners: signersList.map((e) => e.address).toList(),
account: masaterWallet.address,
memos: [exampleMemo],
amount: CurrencyAmount.xrp(XRPHelper.xrpDecimalToDrop("50")),
signingPubKey: ''); // do not set signingPubKey for multisig transaction
destination: destination,
multisigSigners: signersList
.map((e) =>
XRPLSigners.singer(account: e.address, signingPubKey: e.pubHex))
.toList(),
account: masaterWallet.address,
memos: [exampleMemo],
amount: CurrencyAmount.xrp(XRPHelper.xrpDecimalToDrop("50")),
); // do not set signingPubKey for multisig transaction
await XRPHelper.autoFill(masaterWallet.rpc, transaction);
final List<XRPLSigners> signerSignatures = [];
for (final i in signersList) {
final blob = transaction.toMultisigBlob(i.address);
final sig = i.privateKey.sign(blob);
signerSignatures.add(XRPLSigners(
account: i.address, signingPubKey: i.pubHex, txnSignature: sig));
account: i.address,
signingPubKey: i.pubHex,
txnSignature: sig.signature));
}
transaction.setMultiSigSignature(signerSignatures);

Expand All @@ -172,9 +177,11 @@ Future<void> enableMaster(
QuickWallet masterWallet, List<QuickWallet> signersList) async {
final transaction = AccountSet(
account: masterWallet.address,
signingPubKey: "",
clearFlag: AccountSetAsfFlag.asfDisableMaster,
multiSigSigners: signersList.map((e) => e.address).toList(),
multisigSigners: signersList
.map((e) =>
XRPLSigners.singer(account: e.address, signingPubKey: e.pubHex))
.toList(),
memos: [exampleMemo]);
print("autofill trnsction");
await XRPHelper.autoFill(masterWallet.rpc, transaction);
Expand All @@ -183,7 +190,9 @@ Future<void> enableMaster(
final blob = transaction.toMultisigBlob(i.address);
final sig = i.privateKey.sign(blob);
signerSignatures.add(XRPLSigners(
account: i.address, signingPubKey: i.pubHex, txnSignature: sig));
account: i.address,
signingPubKey: i.pubHex,
txnSignature: sig.signature));
}
transaction.setMultiSigSignature(signerSignatures);

Expand Down
10 changes: 5 additions & 5 deletions example/lib/examples/nft/nft.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Future<void> mintToken(QuickWallet wallet) async {
uri: BytesUtils.toHexString(
StringUtils.encode("https://github.com/mrtnetwork/xrpl_dart")),
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
memos: [exampleMemo],
nftokenTaxon: 1);
print("autfil trnsction");
Expand Down Expand Up @@ -103,7 +103,7 @@ Future<void> burnToken(QuickWallet wallet) async {
final transaction = NFTokenBurn(
nfTokenId: tokenId,
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
memos: [exampleMemo],
);
print("autfil trnsction");
Expand Down Expand Up @@ -141,7 +141,7 @@ Future<void> createOffgerForNftWithToken(
flags: NftTokenCreateOfferFlag.tfSellNftoken.value,
nftokenId: tokenId,
account: wallet.address,
signingPubKey: wallet.pubHex,
signer: XRPLSignature.signer(wallet.pubHex),
memos: [exampleMemo],
);
print("autfil trnsction");
Expand Down Expand Up @@ -170,7 +170,7 @@ Future<void> nftTokenAcceptOffer(QuickWallet buyer, String offerID) async {
final offer = NFTokenAcceptOffer(
nfTokenSellOffer: offerID,
account: buyer.address,
signingPubKey: buyer.pubHex,
signer: XRPLSignature.signer(buyer.pubHex),
memos: [exampleMemo],
);
print("autfil trnsction");
Expand Down Expand Up @@ -200,7 +200,7 @@ Future<void> nfTokenCancelOffer(
final offer = NFTokenCancelOffer(
nftokenOffers: offerIdsToCancel,
account: minter.address,
signingPubKey: minter.pubHex,
signer: XRPLSignature.signer(minter.pubHex),
memos: [exampleMemo],
);
print("autfil trnsction");
Expand Down
23 changes: 12 additions & 11 deletions example/lib/examples/offer/offer_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ void offerExamples() async {

Future<void> createOffer(QuickWallet account, String issueAddress) async {
final trustLine = OfferCreate(
account: account.address,
takerGets: CurrencyAmount.xrp(
XRPHelper.xrpDecimalToDrop("25"),
),
takerPays: CurrencyAmount.issue(
IssuedCurrencyAmount(
value: "10.2", currency: "MRT", issuer: issueAddress),
),
memos: [exampleMemo],
signingPubKey: account.pubHex);
account: account.address,
takerGets: CurrencyAmount.xrp(
XRPHelper.xrpDecimalToDrop("25"),
),
takerPays: CurrencyAmount.issue(
IssuedCurrencyAmount(
value: "10.2", currency: "MRT", issuer: issueAddress),
),
memos: [exampleMemo],
signer: XRPLSignature.signer(account.pubHex),
);

await XRPHelper.autoFill(account.rpc, trustLine);
final blob = trustLine.toBlob();
Expand Down Expand Up @@ -53,7 +54,7 @@ Future<void> offerCancel(QuickWallet account) async {
final transaction = OfferCancel(
account: account.address,
offerSequence: offerSequence,
signingPubKey: account.pubHex,
signer: XRPLSignature.signer(account.pubHex),
memos: [exampleMemo],
);
await XRPHelper.autoFill(account.rpc, transaction);
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/payment/payment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Future<void> simplePaymentEdward() async {
amount: CurrencyAmount.xrp(XRPHelper.xrpDecimalToDrop("125.75")),
destination: destination.address,
account: account.address,
signingPubKey: account.pubHex,
signer: XRPLSignature.signer(account.pubHex),
memos: [exampleMemo]);
await XRPHelper.autoFill(account.rpc, transaction);
final blob = transaction.toBlob();
Expand Down Expand Up @@ -50,7 +50,7 @@ Future<void> simplePaymentSecp256() async {
amount: CurrencyAmount.xrp(XRPHelper.xrpDecimalToDrop("125.75")),
destination: destination.address,
account: account.address,
signingPubKey: account.pubHex,
signer: XRPLSignature.signer(account.pubHex),
memos: [exampleMemo]);
await XRPHelper.autoFill(account.rpc, transaction);
final blob = transaction.toBlob();
Expand Down Expand Up @@ -83,7 +83,7 @@ Future<void> exampleWithWebScoket() async {
amount: CurrencyAmount.xrp(XRPHelper.xrpDecimalToDrop("125.75")),
destination: destination.address,
account: account.address,
signingPubKey: account.pubHex,
signer: XRPLSignature.signer(account.pubHex),
memos: [exampleMemo]);
final socketRpc = await XRPLRpc.devNet((httpUri, websocketUri) async {
return await RPCWebSocketService.connect(websocketUri);
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/quick_wallet/quick_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class QuickWallet {
"wallet created $address\n${privateKey.toHex()}\n$pubHex\n====================================");
}
factory QuickWallet.create(int index,
{int account = 2,
{int account = 0,
XRPLRpc? rpc,
XRPKeyAlgorithm algorithm = XRPKeyAlgorithm.secp256k1}) {
final entropy = Bip39SeedGenerator(Mnemonic.fromString(
Expand All @@ -46,8 +46,8 @@ class QuickWallet {
String get xAddress => publicKey.toAddress().toXAddress(forTestnet: true);
String get pubHex => publicKey.toHex();
final XRPLRpc rpc;
Future<void> fucent() async {
final resp = await rpc.getFucent(address);
Future<void> fucent({String? addr}) async {
final resp = await rpc.getFucent(addr ?? address);
print(resp);
}
}
Loading

0 comments on commit 80846eb

Please sign in to comment.