-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
731fb20
commit b981c49
Showing
2 changed files
with
115 additions
and
11 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
docs/api/transaction/get-mempool-transactions.example.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"limit": 96, | ||
"offset": 0, | ||
"total": 5, | ||
"results": [ | ||
{ | ||
"tx_id": "0xb31df5a363dad31723324cb5e0eefa04d491519fd30827a521cbc830114aa50c", | ||
"tx_status": "pending", | ||
"tx_type": "token_transfer", | ||
"receipt_time": 1598288370, | ||
"receipt_time_iso": "2020-08-24T16:59:30.000Z", | ||
"fee_rate": "180", | ||
"sender_address": "STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6", | ||
"sponsored": false, | ||
"post_condition_mode": "deny", | ||
"token_transfer": { | ||
"recipient_address": "ST1GY25DM8RZV4X15X07THRZ2C5NMWPGQWKFGV87F", | ||
"amount": "500000", | ||
"memo": "0x46617563657400000000000000000000000000000000000000000000000000000000" | ||
} | ||
}, | ||
{ | ||
"tx_id": "0x5bed8e3f801cb4e2c74d2815a092f7c1c6a35f2fce4a80c80ca70848d34cb395", | ||
"tx_status": "pending", | ||
"tx_type": "token_transfer", | ||
"receipt_time": 1598282326, | ||
"receipt_time_iso": "2020-08-24T15:18:46.000Z", | ||
"fee_rate": "180", | ||
"sender_address": "ST1PS1KF93VBY5A1JV7TM66KN046KP3E3761DBSAG", | ||
"sponsored": false, | ||
"post_condition_mode": "deny", | ||
"token_transfer": { | ||
"recipient_address": "ST2H33S8SEY27QKEKQKR6S5PECYPKY45CQYGGQR8X", | ||
"amount": "1000", | ||
"memo": "0x00000000000000000000000000000000000000000000000000000000000000000000" | ||
} | ||
}, | ||
{ | ||
"tx_id": "0x9916036fde08a207e581cdcabc18ff55469861cb81194ab0e3e7c9a02cd5a17c", | ||
"tx_status": "pending", | ||
"tx_type": "smart_contract", | ||
"receipt_time": 1598258958, | ||
"receipt_time_iso": "2020-08-24T08:49:18.000Z", | ||
"fee_rate": "2000", | ||
"sender_address": "ST2R1XSFXYHCSFE426HP45TTD8ZWV9XHX2SRP3XA8", | ||
"sponsored": false, | ||
"post_condition_mode": "deny", | ||
"post_conditions": [], | ||
"smart_contract": { | ||
"contract_id": "ST2R1XSFXYHCSFE426HP45TTD8ZWV9XHX2SRP3XA8.test-loans-1", | ||
"source_code": "(define-data-var stx-loaned int 0)\n(define-data-var lockup-period int 0)\n(define-data-var stx-return int 0)\n(define-public (get-stx-return (stx uint) (months uint))\n (ok\n (begin\n (var-set stx-loaned (to-int(stx))\n (var-set lockup-period (to-int(months))\n (calculate-stx-return)\n (print (var-get stx-return))\n (transfer-to-server)\n )\n )\n)\n(define-private (calculate-stx-return)\n (ok\n (begin\n (var-set stx-return (- (+ (* (/ (* (var-get stx-loaned) 5) 100) (var-get lockup-period)) (var-get stx-loaned)) 5))\n )\n )\n)\n(define-private (transfer-to-server)\n (begin\n (unwrap-panic (stx-transfer? (to-uint (var-get stx-loaned)) tx-sender 'ST2R1XSFXYHCSFE426HP45TTD8ZWV9XHX2SRP3XA8))\n (ok (to-uint (var-get stx-loaned)))\n )\n)" | ||
} | ||
}, | ||
{ | ||
"tx_id": "0x871fb186c8d6ac6ede2822c71074d9884b593c0d7f2d0d6e8516e615484d7501", | ||
"tx_status": "pending", | ||
"tx_type": "smart_contract", | ||
"receipt_time": 1598230365, | ||
"receipt_time_iso": "2020-08-24T00:52:45.000Z", | ||
"fee_rate": "2000", | ||
"sender_address": "ST1FJGMWPGM1P7N0K3N9QEPZK5H1VDC5YWTVMEAZ1", | ||
"sponsored": false, | ||
"post_condition_mode": "deny", | ||
"post_conditions": [], | ||
"smart_contract": { | ||
"contract_id": "ST1FJGMWPGM1P7N0K3N9QEPZK5H1VDC5YWTVMEAZ1.contract-hook-1598230358601", | ||
"source_code": ";; ## CUSTOM FUNCTION TO EXTRACT A SUBSTRING\n\n(define-read-only (subs (source (buff 10)) \n (start int) \n (end int))\n (begin\n (unwrap-panic (if (and (<= 0 start) (<= start 10)) (ok 1) (err \"Out of bounds: start\")))\n (unwrap-panic (if (and (<= 0 end) (<= end 10)) (ok 1) (err \"Out of bounds: end\")))\n (let ((temp1 (fold subs1 source \n {start: start, end: end, cursor: 1, data: \"\"})))\n (let ((data (get data temp1))) \n data))))\n \n;; Call the function to extract the substring between the bounds:\n\n;; (subs \"123456789\" 2 5)\n\n(define-read-only (subs1 \n (ch (buff 1))\n (acc {data: (buff 10), \n start: int,\n end: int,\n cursor: int})) \n (let ((data (get data acc))\n (start (get start acc))\n (cursor (get cursor acc))\n (end (get end acc))) \n (let ((temp2 \n {cursor: (+ 1 cursor),\n data: (default-to \"\"\n (as-max-len?\n (concat data \n (if (let ((temp3 start)\n (temp4 cursor)\n (temp5 end))\n (and (<= temp3 temp4)\n (<= temp4 temp5)))\n ch \n \"\"))\n u10))}))\n {start: (get start acc),\n end: (get end acc),\n cursor: (get cursor temp2),\n data: (get data temp2)})))\n" | ||
} | ||
}, | ||
{ | ||
"tx_id": "0x66df10d99d3a26018f521d60e9f744b083386c73e47ad39c394d570abee55f1f", | ||
"tx_status": "pending", | ||
"tx_type": "smart_contract", | ||
"receipt_time": 1598230066, | ||
"receipt_time_iso": "2020-08-24T00:47:46.000Z", | ||
"fee_rate": "2000", | ||
"sender_address": "ST1FJGMWPGM1P7N0K3N9QEPZK5H1VDC5YWTVMEAZ1", | ||
"sponsored": false, | ||
"post_condition_mode": "deny", | ||
"post_conditions": [], | ||
"smart_contract": { | ||
"contract_id": "ST1FJGMWPGM1P7N0K3N9QEPZK5H1VDC5YWTVMEAZ1.contract-hook-1598230054238", | ||
"source_code": "(define-read-only (subs1 \n (ch (buff 1))\n (acc {data: (buff 10), \n start: int,\n end: int,\n cursor: int}))\n (begin\n (unwrap-panic (if (and (<= 1 (get start acc)) (<= (get start acc) 10)) (ok 1) (err \"Out of bounds: start\")))\n (unwrap-panic (if (and (<= 1 (get end acc)) (<= (get end acc) 10)) (ok 1) (err \"Out of bounds: end\")))\n (unwrap-panic (if (and (<= 1 (get cursor acc)) (<= (get cursor acc) 10)) (ok 1) (err \"Out of bounds: cursor\")))\n (let ((data (get data acc))\n (start (get start acc))\n (cursor (get cursor acc))\n (end (get end acc))) \n (let ((temp1 \n {cursor: (+ 1 cursor),\n data: (default-to \"\"\n (as-max-len?\n (concat data \n (if (let ((temp2 start)\n (temp3 cursor)\n (temp4 end))\n (and (<= temp2 temp3)\n (<= temp3 temp4)))\n ch \n \"\"))\n u10))}))\n {start: (get start acc),\n end: (get end acc),\n cursor: (get cursor temp1),\n data: (get data temp1)}))))\n" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters